13 Commits

Author SHA1 Message Date
f6b8844a82 Merge pull request #40 from BlackMATov/dev
Dev
2026-02-02 08:30:39 +07:00
BlackMATov
7ce5ee924c v1.9.0 2026-02-02 08:28:27 +07:00
BlackMATov
539a62c8a8 shrink table pools on gc 2026-02-02 08:21:40 +07:00
BlackMATov
63a7ab5c79 update roadmap 2026-02-02 08:21:29 +07:00
BlackMATov
9a9fb1ddb9 Merge branch 'feature/determinism' into dev 2026-02-02 07:39:44 +07:00
BlackMATov
7b44740803 deterministic chunk ordering 2026-02-02 07:38:02 +07:00
BlackMATov
b0d035c0d4 migrate root chunks map to separated set/list 2026-01-28 02:26:06 +07:00
BlackMATov
8d88d55267 Merge branch 'feature/id_opts' into dev 2026-01-27 08:22:55 +07:00
BlackMATov
b774abf63c update readme 2026-01-27 08:22:39 +07:00
BlackMATov
4a018f4c40 specialize clean/destroy functions 2026-01-27 08:06:12 +07:00
BlackMATov
39c20f13dd clear hash part pool tables only when needed 2026-01-26 23:40:10 +07:00
BlackMATov
ce864b7433 acquire temp tables only on-demand 2026-01-26 21:16:13 +07:00
BlackMATov
04c9e4aaeb new id bmarks 2026-01-26 17:46:22 +07:00
7 changed files with 796 additions and 288 deletions

View File

@@ -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)
@@ -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

View File

@@ -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

View File

@@ -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'

View File

@@ -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)

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
rockspec_format = "3.0"
package = "evolved.lua"
version = "1.9.0-0"
source = {
url = "git://github.com/BlackMATov/evolved.lua",
tag = "v1.9.0",
}
description = {
homepage = "https://github.com/BlackMATov/evolved.lua",
summary = "Evolved ECS (Entity-Component-System) for Lua",
detailed = [[
`evolved.lua` is a fast and flexible ECS (Entity-Component-System) library for Lua.
It is designed to be simple and easy to use, while providing all the features needed to create complex systems with blazing performance.
]],
license = "MIT",
labels = {
"ecs",
"entity",
"entities",
"component",
"components",
"entity-component",
"entity-component-system",
},
}
dependencies = {
"lua >= 5.1",
}
build = {
type = "builtin",
modules = {
evolved = "evolved.lua",
}
}