Skip to content
Merged

Dev #40

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
- [Chunk](#chunk)
- [Builder](#builder)
- [Changelog](#changelog)
- [v1.9.0](#v190)
- [v1.8.0](#v180)
- [v1.7.0](#v170)
- [v1.6.0](#v160)
Expand Down Expand Up @@ -1565,6 +1566,11 @@ builder_mt:destruction_policy :: id -> builder

## Changelog

### v1.9.0

- Performance improvements of the [`evolved.destroy`](#evolveddestroy) and [`evolved.batch_destroy`](#evolvedbatch_destroy) functions
- Ensured deterministic chunk ordering to improve processing consistency across runs

### v1.8.0

- Added the new [`evolved.REALLOC`](#evolvedrealloc) and [`evolved.COMPMOVE`](#evolvedcompmove) fragment traits that allow customizing component storages
Expand Down
5 changes: 0 additions & 5 deletions develop/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@
- observers and events
- add INDEX fragment trait
- use compact prefix-tree for chunks
- optional ffi component storages

## Thoughts

- We should have a way to not copy components on deferred spawn/clone
- Not all assoc_list_remove operations need to keep order, we can have an unordered variant also
- We still have several places where we use __lua_next without deterministic order, we should fix that
- Having a light version of the gargabe collector can be useful for some use-cases
- We can shrink the table pool tables on garbage collection if they are too large
- Should we sort chunk children by fragment id?
- Basic default component value as true looks awful, should we use something else?

## Known Issues
Expand Down
1 change: 1 addition & 0 deletions develop/all.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ require 'develop.testing.system_as_query_tests'

require 'develop.benchmarks.clone_bmarks'
require 'develop.benchmarks.common_bmarks'
require 'develop.benchmarks.destroy_bmarks'
require 'develop.benchmarks.migration_bmarks'
require 'develop.benchmarks.process_bmarks'
require 'develop.benchmarks.spawn_bmarks'
Expand Down
56 changes: 56 additions & 0 deletions develop/benchmarks/destroy_bmarks.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
local evo = require 'evolved'
local basics = require 'develop.basics'

evo.debug_mode(false)

local N = 1000

print '----------------------------------------'

basics.describe_bench(string.format('Destroy Benchmarks: Acquire and Release %d ids', N),
function(tables)
local id = evo.id
local destroy = evo.destroy

for i = 1, N do
tables[i] = id()
end

for i = 1, N do
destroy(tables[i])
end
end, function()
return {}
end)

basics.describe_bench(string.format('Destroy Benchmarks: Acquire and Release %d double ids', N),
function(tables)
local id = evo.id
local destroy = evo.destroy

for i = 1, N, 2 do
tables[i], tables[i + 1] = id(2)
end

for i = 1, N, 2 do
destroy(tables[i], tables[i + 1])
end
end, function()
return {}
end)

basics.describe_bench(string.format('Destroy Benchmarks: Acquire and Release %d triple ids', N),
function(tables)
local id = evo.id
local destroy = evo.destroy

for i = 1, N, 3 do
tables[i], tables[i + 1], tables[i + 2] = id(3)
end

for i = 1, N, 3 do
destroy(tables[i], tables[i + 1], tables[i + 2])
end
end, function()
return {}
end)
61 changes: 50 additions & 11 deletions develop/testing/main_tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2302,27 +2302,66 @@ do
evo.set(e2, f2, 44)

do
local iter, state = evo.execute(q)
local chunk = iter(state)
assert(chunk and chunk ~= evo.chunk(f1))
local e1_count = 0
local e2_count = 0

for _, entity_list, entity_count in evo.execute(q) do
for i = 1, entity_count do
if entity_list[i] == e1 then
e1_count = e1_count + 1
elseif entity_list[i] == e2 then
e2_count = e2_count + 1
end
end
end

assert(e1_count == 1)
assert(e2_count == 1)
end

evo.set(q, evo.EXCLUDES, { f2 })

do
local iter, state = evo.execute(q)
local chunk = iter(state)
assert(chunk and chunk ~= evo.chunk(f1))
local e1_count = 0
local e2_count = 0

for chunk, entity_list, entity_count in evo.execute(q) do
assert(not chunk:has(f2))

for i = 1, entity_count do
if entity_list[i] == e1 then
e1_count = e1_count + 1
elseif entity_list[i] == e2 then
e2_count = e2_count + 1
end
end
end

assert(e1_count == 1)
assert(e2_count == 0)
end

evo.set(q, evo.INCLUDES, { f1 })

do
local iter, state = evo.execute(q)
local chunk, entity_list, entity_count = iter(state)
assert(chunk == evo.chunk(f1))
assert(entity_list and entity_list[1] == e1)
assert(entity_count == 1)
local e1_count = 0
local e2_count = 0

for chunk, entity_list, entity_count in evo.execute(q) do
assert(chunk:has(f1))
assert(not chunk:has(f2))

for i = 1, entity_count do
if entity_list[i] == e1 then
e1_count = e1_count + 1
elseif entity_list[i] == e2 then
e2_count = e2_count + 1
end
end
end

assert(e1_count == 1)
assert(e2_count == 0)
end
end

Expand Down
Loading
Loading