Skip to content

Commit

Permalink
Add visual benchmark for delete
Browse files Browse the repository at this point in the history
  • Loading branch information
Ukendio committed Aug 13, 2024
1 parent 8dd53b8 commit d4fbc40
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions benches/visual/despawn.bench.luau
Original file line number Diff line number Diff line change
@@ -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;
};
}

0 comments on commit d4fbc40

Please sign in to comment.