mirror of
https://github.com/BlackMATov/evolved.lua.git
synced 2026-01-04 17:20:58 +07:00
bench tweaks
This commit is contained in:
@@ -16,7 +16,7 @@ print '*******************'
|
|||||||
---@param C evolved.query
|
---@param C evolved.query
|
||||||
---@param D evolved.query
|
---@param D evolved.query
|
||||||
---@param E evolved.query
|
---@param E evolved.query
|
||||||
common.describe('Evolved Packed Iteration', function(a, b, c, d, e, A, B, C, D, E)
|
common.describe('Packed Iteration', function(a, b, c, d, e, A, B, C, D, E)
|
||||||
for chunk in A:execute() do
|
for chunk in A:execute() do
|
||||||
local as = chunk:components(a)
|
local as = chunk:components(a)
|
||||||
for i = 1, #chunk:entities() do as[i] = as[i] * 2 end
|
for i = 1, #chunk:entities() do as[i] = as[i] * 2 end
|
||||||
@@ -62,7 +62,7 @@ end, function()
|
|||||||
evo.registry.query(E)
|
evo.registry.query(E)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
common.describe('Evolved Simple Iteration', function(a, b, c, d, e, AB, CD, CE)
|
common.describe('Simple Iteration', function(a, b, c, d, e, AB, CD, CE)
|
||||||
for chunk in AB:execute() do
|
for chunk in AB:execute() do
|
||||||
local as, bs = chunk:components(a, b)
|
local as, bs = chunk:components(a, b)
|
||||||
for i = 1, #chunk:entities() do as[i], bs[i] = bs[i], as[i] end
|
for i = 1, #chunk:entities() do as[i], bs[i] = bs[i], as[i] end
|
||||||
@@ -102,7 +102,7 @@ end)
|
|||||||
---@param z evolved.entity
|
---@param z evolved.entity
|
||||||
---@param Data evolved.query
|
---@param Data evolved.query
|
||||||
---@param Z evolved.query
|
---@param Z evolved.query
|
||||||
common.describe('Evolved Fragmented Iteration', function(d, z, Data, Z)
|
common.describe('Fragmented Iteration', function(d, z, Data, Z)
|
||||||
for chunk in Data:execute() do
|
for chunk in Data:execute() do
|
||||||
local ds = chunk:components(d)
|
local ds = chunk:components(d)
|
||||||
for i = 1, #chunk:entities() do ds[i] = ds[i] * 2 end
|
for i = 1, #chunk:entities() do ds[i] = ds[i] * 2 end
|
||||||
@@ -131,7 +131,7 @@ end)
|
|||||||
---@param b evolved.entity
|
---@param b evolved.entity
|
||||||
---@param A evolved.query
|
---@param A evolved.query
|
||||||
---@param B evolved.query
|
---@param B evolved.query
|
||||||
common.describe('Evolved Entity Cycle', function(a, b, A, B)
|
common.describe('Entity Cycle', function(a, b, A, B)
|
||||||
---@type any[]
|
---@type any[]
|
||||||
local to_create = {}
|
local to_create = {}
|
||||||
|
|
||||||
@@ -164,15 +164,15 @@ end)
|
|||||||
---@param b evolved.entity
|
---@param b evolved.entity
|
||||||
---@param A evolved.query
|
---@param A evolved.query
|
||||||
---@param AB evolved.query
|
---@param AB evolved.query
|
||||||
common.describe('Evolved Add / Remove', function(b, A, AB)
|
common.describe('Add / Remove', function(b, A, AB)
|
||||||
assert(1000 == evo.registry.batch_insert(A, b))
|
assert(10000 == evo.registry.batch_insert(A, b))
|
||||||
assert(1000 == evo.registry.batch_remove(AB, b))
|
assert(10000 == evo.registry.batch_remove(AB, b))
|
||||||
end, function()
|
end, function()
|
||||||
local a, b =
|
local a, b =
|
||||||
evo.registry.entity(),
|
evo.registry.entity(),
|
||||||
evo.registry.entity()
|
evo.registry.entity()
|
||||||
|
|
||||||
for _ = 1, 1000 do
|
for _ = 1, 10000 do
|
||||||
evo.registry.entity():set(a)
|
evo.registry.entity():set(a)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ print '********************'
|
|||||||
print '***** tiny-ecs *****'
|
print '***** tiny-ecs *****'
|
||||||
print '********************'
|
print '********************'
|
||||||
|
|
||||||
common.describe('Tiny Packed Iteration', function(w)
|
common.describe('Packed Iteration', function(w)
|
||||||
tiny.update(w, 0.016)
|
tiny.update(w, 0.016)
|
||||||
end, function()
|
end, function()
|
||||||
local w = tiny.world()
|
local w = tiny.world()
|
||||||
@@ -44,7 +44,7 @@ end, function()
|
|||||||
return w
|
return w
|
||||||
end)
|
end)
|
||||||
|
|
||||||
common.describe('Tiny Simple Iteration', function(w)
|
common.describe('Simple Iteration', function(w)
|
||||||
tiny.update(w, 0.016)
|
tiny.update(w, 0.016)
|
||||||
end, function()
|
end, function()
|
||||||
local w = tiny.world()
|
local w = tiny.world()
|
||||||
@@ -75,7 +75,7 @@ end, function()
|
|||||||
return w
|
return w
|
||||||
end)
|
end)
|
||||||
|
|
||||||
common.describe('Tiny Fragmented Iteration', function(w)
|
common.describe('Fragmented Iteration', function(w)
|
||||||
tiny.update(w, 0.016)
|
tiny.update(w, 0.016)
|
||||||
end, function()
|
end, function()
|
||||||
local w = tiny.world()
|
local w = tiny.world()
|
||||||
@@ -101,7 +101,7 @@ end, function()
|
|||||||
return w
|
return w
|
||||||
end)
|
end)
|
||||||
|
|
||||||
common.describe('Tiny Entity Cycle', function(w)
|
common.describe('Entity Cycle', function(w)
|
||||||
tiny.update(w, 0.016)
|
tiny.update(w, 0.016)
|
||||||
end, function()
|
end, function()
|
||||||
local w = tiny.world()
|
local w = tiny.world()
|
||||||
@@ -126,12 +126,12 @@ end, function()
|
|||||||
return w
|
return w
|
||||||
end)
|
end)
|
||||||
|
|
||||||
common.describe('Tiny Add / Remove', function(w)
|
common.describe('Add / Remove', function(w)
|
||||||
tiny.update(w, 0.016)
|
tiny.update(w, 0.016)
|
||||||
end, function()
|
end, function()
|
||||||
local w = tiny.world()
|
local w = tiny.world()
|
||||||
|
|
||||||
for _ = 1, 1000 do
|
for _ = 1, 10000 do
|
||||||
tiny.addEntity(w, { a = 0 })
|
tiny.addEntity(w, { a = 0 })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user