Optimize C++ compilation time

This commit is contained in:
Wojtek Figat
2021-04-30 16:27:57 +02:00
parent 05ba9b8d45
commit 0e75dba142
222 changed files with 1095 additions and 1506 deletions

View File

@@ -5,7 +5,9 @@
#include "Engine/Core/Types/Guid.h"
#include "Engine/Core/Types/Pair.h"
#include "Engine/Core/Types/String.h"
#include "Engine/Core/Types/DataContainer.h"
#if USE_EDITOR
#include "Engine/Core/Collections/Array.h"
#endif
#include "FlaxChunk.h"
/// <summary>
@@ -54,7 +56,8 @@ public:
/// Gets the chunks.
/// </summary>
/// <param name="output">The output data.</param>
void GetChunks(Array<FlaxChunk*>& output) const
template<typename AllocationType = HeapAllocation>
void GetChunks(Array<FlaxChunk*, AllocationType>& output) const
{
for (int32 i = 0; i < ASSET_FILE_DATA_CHUNKS; i++)
{
@@ -67,7 +70,8 @@ public:
/// Gets the chunks that are loaded.
/// </summary>
/// <param name="output">The output data.</param>
void GetLoadedChunks(Array<FlaxChunk*>& output) const
template<typename AllocationType = HeapAllocation>
void GetLoadedChunks(Array<FlaxChunk*, AllocationType>& output) const
{
for (int32 i = 0; i < ASSET_FILE_DATA_CHUNKS; i++)
{
@@ -130,7 +134,7 @@ struct FLAXENGINE_API AssetInitData
/// <summary>
/// The serialized asset version
/// </summary>
uint32 SerializedVersion;
uint32 SerializedVersion = 0;
/// <summary>
/// The custom asset data (should be small, for eg. texture description structure).
@@ -138,7 +142,6 @@ struct FLAXENGINE_API AssetInitData
BytesContainer CustomData;
#if USE_EDITOR
/// <summary>
/// The asset metadata information. Stored in a Json format.
/// </summary>
@@ -148,24 +151,16 @@ struct FLAXENGINE_API AssetInitData
/// Asset dependencies list used by the asset for tracking (eg. material functions used by material asset). The pair of asset ID and cached file edit time (for tracking modification).
/// </summary>
Array<Pair<Guid, DateTime>> Dependencies;
#endif
public:
AssetInitData()
: SerializedVersion(0)
{
}
/// <summary>
/// Gets the hash code.
/// </summary>
/// <returns>Hash Code</returns>
uint32 GetHashCode() const
{
// Note: do not use Metadata/Dependencies because it may not be loaded (it's optional)
uint32 hashCode = GetHash(Header.ID);
hashCode = (hashCode * 397) ^ SerializedVersion;
hashCode = (hashCode * 397) ^ CustomData.Length();

View File

@@ -3,6 +3,7 @@
#pragma once
#include "FlaxStorageReference.h"
#include "Engine/Core/Types/TimeSpan.h"
class FlaxFile;
class FlaxPackage;

View File

@@ -5,10 +5,15 @@
#include "FlaxPackage.h"
#include "ContentStorageManager.h"
#include "Engine/Core/Log.h"
#include "Engine/Core/Types/TimeSpan.h"
#include "Engine/Platform/File.h"
#include "Engine/Serialization/FileWriteStream.h"
#if USE_EDITOR
#include "Engine/Serialization/JsonWriter.h"
#include "Engine/Serialization/JsonWriters.h"
#else
#include "Engine/Engine/Globals.h"
#endif
#include <ThirdParty/LZ4/lz4.h>
String AssetHeader::ToString() const

View File

@@ -5,7 +5,7 @@
#include "FlaxStorage.h"
/// <summary>
/// Flax Storage Container Reference
/// Flax Storage container reference.
/// </summary>
struct FLAXENGINE_API FlaxStorageReference
{
@@ -44,10 +44,8 @@ public:
public:
// Assignment operator
FlaxStorageReference& operator=(const FlaxStorageReference& other)
{
// Protect against invalid self-assignment
if (this != &other)
{
if (_storage)
@@ -56,7 +54,6 @@ public:
if (_storage)
_storage->AddRef();
}
return *this;
}