mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-24 17:10:03 +00:00
Add visual benchmark for delete
This commit is contained in:
parent
8dd53b8c2a
commit
d4fbc409bf
1 changed files with 48 additions and 0 deletions
48
benches/visual/despawn.bench.luau
Normal file
48
benches/visual/despawn.bench.luau
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
--!optimize 2
|
||||||
|
--!native
|
||||||
|
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
local Matter = require(ReplicatedStorage.DevPackages.Matter)
|
||||||
|
local ecr = require(ReplicatedStorage.DevPackages.ecr)
|
||||||
|
local jecs = require(ReplicatedStorage.Lib)
|
||||||
|
local rgb = require(ReplicatedStorage.rgb)
|
||||||
|
local newWorld = Matter.World.new()
|
||||||
|
local ecs = jecs.World.new()
|
||||||
|
|
||||||
|
local A, B = Matter.component(), Matter.component()
|
||||||
|
local C, D = ecs:component(), ecs:component()
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
ParameterGenerator = function()
|
||||||
|
local matter_entities = {}
|
||||||
|
local jecs_entities = {}
|
||||||
|
local entities = {
|
||||||
|
matter = matter_entities,
|
||||||
|
jecs = jecs_entities
|
||||||
|
}
|
||||||
|
for i = 1, 1000 do
|
||||||
|
table.insert(matter_entities, newWorld:spawn(A(), B()))
|
||||||
|
local e = ecs:entity()
|
||||||
|
ecs:set(e, C, {})
|
||||||
|
ecs:set(e, D, {})
|
||||||
|
table.insert(jecs_entities, e)
|
||||||
|
end
|
||||||
|
return entities
|
||||||
|
end;
|
||||||
|
|
||||||
|
Functions = {
|
||||||
|
Matter = function(_, entities)
|
||||||
|
for _, entity in entities.matter do
|
||||||
|
newWorld:despawn(entity)
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Jecs = function(_, entities)
|
||||||
|
for _, entity in entities.jecs do
|
||||||
|
ecs:delete(entity)
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue