mirror of
https://github.com/BlackMATov/evolved.lua.git
synced 2026-09-26 22:01:44 +07:00
benches tweaks
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user