ECS core imprevement
-Adedd function to resize array to Mallocator -significant speed up for first time ID allocation by using resizeArray instead of makeArray -fix: onUpdate called with zero length arrays -call updateBlocks before updateEvents (it's more accurate behaviour) -some minore fixes -fixed meson.build for GDC
This commit is contained in:
parent
66860b9042
commit
13e6ed8fd5
4 changed files with 83 additions and 36 deletions
|
|
@ -177,15 +177,9 @@ struct IDManager
|
|||
if (m_last_id > m_ids_array.length)
|
||||
{
|
||||
uint begin = cast(uint) m_ids_array.length;
|
||||
Data[] new_array = Mallocator.makeArray!Data(begin + (m_blocks_count << 16));
|
||||
memcpy(new_array.ptr, m_ids_array.ptr, m_ids_array.length * Data.sizeof);
|
||||
Mallocator.dispose(m_ids_array);
|
||||
m_ids_array = new_array;
|
||||
|
||||
uint[] new_stack = Mallocator.makeArray!uint(m_ids_array.length);
|
||||
memcpy(new_stack.ptr, m_free_stack.ptr, m_free_stack.length * uint.sizeof);
|
||||
Mallocator.dispose(m_free_stack);
|
||||
m_free_stack = new_stack;
|
||||
m_ids_array = Mallocator.resizeArray(m_ids_array, begin + (m_blocks_count << 16));
|
||||
m_free_stack = Mallocator.resizeArray(m_free_stack, m_ids_array.length);
|
||||
|
||||
foreach (block; m_blocks[0 .. m_blocks_count - 1])
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue