benches tweaks

This commit is contained in:
BlackMATov
2024-12-04 07:24:47 +07:00
parent b6643584f0
commit cc9f0ef2e5
3 changed files with 17 additions and 8 deletions
+3 -2
View File
@@ -17,10 +17,10 @@ function common.describe(name, loop, init)
local start_kb = collectgarbage('count')
local success, result = pcall(function()
while os.clock() - start_s < 0.2 do
repeat
iters = iters + 1
loop(evo.compat.unpack(state))
end
until os.clock() - start_s > 0.2
end)
local finish_s = os.clock()
@@ -35,6 +35,7 @@ function common.describe(name, loop, init)
if not success then print(' ' .. result) end
collectgarbage('restart')
collectgarbage('collect')
end
return common
+7 -3
View File
@@ -2,6 +2,10 @@ local common = require 'develop.unbench.common_unbench'
local evo = require 'evolved.evolved'
print '*******************'
print '***** evolved *****'
print '*******************'
---@param a evolved.entity
---@param b evolved.entity
---@param c evolved.entity
@@ -45,7 +49,7 @@ end, function()
evo.registry.entity(),
evo.registry.entity()
for _ = 1, 1000 do
for _ = 1, 10000 do
evo.registry.entity():set(A, 0):set(B, 0):set(C, 0):set(D, 0):set(E, 0)
end
@@ -81,7 +85,7 @@ end, function()
evo.registry.entity(),
evo.registry.entity()
for _ = 1, 1000 do
for _ = 1, 10000 do
evo.registry.entity():set(A, 0):set(B, 0)
evo.registry.entity():set(A, 0):set(B, 0):set(C, 0)
evo.registry.entity():set(A, 0):set(B, 0):set(C, 0):set(D, 0)
@@ -113,7 +117,7 @@ end, function()
for i = 1, 26 do chars[i] = evo.registry.entity() end
for i = 1, #chars do
for _ = 1, 100 do
for _ = 1, 10000 do
evo.registry.entity():set(chars[i], 0):set(data, 0)
end
end
+7 -3
View File
@@ -2,12 +2,16 @@ local common = require 'develop.unbench.common_unbench'
local tiny = require 'develop.3rdparty.tiny'
print '********************'
print '***** tiny-ecs *****'
print '********************'
common.describe('Tiny Packed Iteration', function(w)
tiny.update(w, 0.016)
end, function()
local w = tiny.world()
for _ = 1, 1000 do
for _ = 1, 10000 do
tiny.addEntity(w, { a = 0, b = 0, c = 0, d = 0, e = 0 })
end
@@ -45,7 +49,7 @@ common.describe('Tiny Simple Iteration', function(w)
end, function()
local w = tiny.world()
for _ = 1, 1000 do
for _ = 1, 10000 do
tiny.addEntity(w, { a = 0, b = 0 })
tiny.addEntity(w, { a = 0, b = 0, c = 0 })
tiny.addEntity(w, { a = 0, b = 0, c = 0, d = 0 })
@@ -77,7 +81,7 @@ end, function()
local w = tiny.world()
for i = 1, 26 do
for _ = 1, 100 do
for _ = 1, 10000 do
local char = string.char(string.byte('a') + i - 1)
tiny.addEntity(w, { [char] = 0, data = 0 })
end