Add a way to hint the initial size of the serialiser buffer

This commit is contained in:
baldurk
2016-11-18 18:38:28 +01:00
parent 0789f8f3d4
commit 5ae3cdf7fb
3 changed files with 7 additions and 4 deletions
+4 -1
View File
@@ -162,7 +162,10 @@ WrappedID3D12CommandQueue::WrappedID3D12CommandQueue(ID3D12CommandQueue *real,
}
else
{
m_pSerialiser = new Serialiser(NULL, Serialiser::WRITING, debugSerialiser);
// make serialisers smaller by default since we create a lot of these internally for small
// commands.
// User lists will quickly grow to a steady-state over time.
m_pSerialiser = new Serialiser(NULL, Serialiser::WRITING, debugSerialiser, 256);
m_pSerialiser->SetDebugText(debugSerialiser);
}
+2 -2
View File
@@ -634,7 +634,7 @@ Serialiser::Serialiser(size_t length, const byte *memoryBuf, bool fileheader)
}
}
Serialiser::Serialiser(const char *path, Mode mode, bool debugMode)
Serialiser::Serialiser(const char *path, Mode mode, bool debugMode, uint64_t sizeHint)
: m_pCallstack(NULL), m_pResolver(NULL), m_Buffer(NULL)
{
m_ResolverThread = 0;
@@ -935,7 +935,7 @@ Serialiser::Serialiser(const char *path, Mode mode, bool debugMode)
}
else
{
m_BufferSize = 128 * 1024;
m_BufferSize = sizeHint;
m_BufferHead = m_Buffer = AllocAlignedBuffer((size_t)m_BufferSize);
}
}
+1 -1
View File
@@ -199,7 +199,7 @@ public:
// Init and error handling
Serialiser(size_t length, const byte *memoryBuf, bool fileheader);
Serialiser(const char *path, Mode mode, bool debugMode = false);
Serialiser(const char *path, Mode mode, bool debugMode, uint64_t sizeHint = 128 * 1024);
~Serialiser();
bool HasError() { return m_HasError; }