From 71a7c84a67bcab6aca0522147d1a0e1c8bd69231 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Thu, 20 Nov 2025 16:19:13 +0700 Subject: [PATCH] add spawn/clone with defaults bmarks --- develop/benchmarks/clone_bmarks.lua | 326 +++++++++++++++---- develop/benchmarks/spawn_bmarks.lua | 466 ++++++++++++++++++++++------ 2 files changed, 636 insertions(+), 156 deletions(-) diff --git a/develop/benchmarks/clone_bmarks.lua b/develop/benchmarks/clone_bmarks.lua index 1486d41..be299ca 100644 --- a/develop/benchmarks/clone_bmarks.lua +++ b/develop/benchmarks/clone_bmarks.lua @@ -6,16 +6,35 @@ evo.debug_mode(false) local N = 1000 local F1, F2, F3, F4, F5 = evo.id(5) +local D1, D2, D3, D4, D5 = evo.id(5) -local Q1 = evo.builder():include(F1):spawn() +evo.set(D1, evo.DEFAULT, true) +evo.set(D2, evo.DEFAULT, true) +evo.set(D3, evo.DEFAULT, true) +evo.set(D4, evo.DEFAULT, true) +evo.set(D5, evo.DEFAULT, true) -local R1 = evo.builder():require(F1):spawn() -local R3 = evo.builder():require(F1, F2, F3):spawn() -local R5 = evo.builder():require(F1, F2, F3, F4, F5):spawn() +evo.set(D1, evo.DUPLICATE, function(v) return not v end) +evo.set(D2, evo.DUPLICATE, function(v) return not v end) +evo.set(D3, evo.DUPLICATE, function(v) return not v end) +evo.set(D4, evo.DUPLICATE, function(v) return not v end) +evo.set(D5, evo.DUPLICATE, function(v) return not v end) + +local QF1 = evo.builder():include(F1):spawn() +local QD1 = evo.builder():include(D1):spawn() + +local RF1 = evo.builder():require(F1):spawn() +local RF123 = evo.builder():require(F1, F2, F3):spawn() +local RF12345 = evo.builder():require(F1, F2, F3, F4, F5):spawn() + +local RD1 = evo.builder():require(D1):spawn() +local RD123 = evo.builder():require(D1, D2, D3):spawn() +local RD12345 = evo.builder():require(D1, D2, D3, D4, D5):spawn() print '----------------------------------------' -basics.describe_bench(string.format('Clone Benchmarks: Simple Clone | %d entities with 1 component', N), +basics.describe_bench( + string.format('Clone Benchmarks: Simple Clone | %d entities with 1 component', N), function() local clone = evo.clone @@ -25,10 +44,11 @@ basics.describe_bench(string.format('Clone Benchmarks: Simple Clone | %d entitie clone(prefab) end - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Simple Defer Clone | %d entities with 1 component', N), +basics.describe_bench( + string.format('Clone Benchmarks: Simple Defer Clone | %d entities with 1 component', N), function() local clone = evo.clone @@ -40,10 +60,25 @@ basics.describe_bench(string.format('Clone Benchmarks: Simple Defer Clone | %d e end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Simple Clone | %d entities with 3 components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Simple Clone With Defaults | %d entities with 1 component', N), + function() + local clone = evo.clone + + local prefab = evo.spawn { [D1] = true } + + for _ = 1, N do + clone(prefab) + end + + evo.batch_destroy(QD1) + end) + +basics.describe_bench( + string.format('Clone Benchmarks: Simple Clone | %d entities with 3 components', N), function() local clone = evo.clone @@ -53,10 +88,11 @@ basics.describe_bench(string.format('Clone Benchmarks: Simple Clone | %d entitie clone(prefab) end - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Simple Defer Clone | %d entities with 3 components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Simple Defer Clone | %d entities with 3 components', N), function() local clone = evo.clone @@ -68,10 +104,25 @@ basics.describe_bench(string.format('Clone Benchmarks: Simple Defer Clone | %d e end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Simple Clone | %d entities with 5 components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Simple Clone With Defaults | %d entities with 3 components', N), + function() + local clone = evo.clone + + local prefab = evo.spawn { [D1] = true, [D2] = true, [D3] = true } + + for _ = 1, N do + clone(prefab) + end + + evo.batch_destroy(QD1) + end) + +basics.describe_bench( + string.format('Clone Benchmarks: Simple Clone | %d entities with 5 components', N), function() local clone = evo.clone @@ -81,10 +132,11 @@ basics.describe_bench(string.format('Clone Benchmarks: Simple Clone | %d entitie clone(prefab) end - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Simple Defer Clone | %d entities with 5 components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Simple Defer Clone | %d entities with 5 components', N), function() local clone = evo.clone @@ -96,29 +148,45 @@ basics.describe_bench(string.format('Clone Benchmarks: Simple Defer Clone | %d e end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Clone Benchmarks: Simple Clone With Defaults | %d entities with 5 components', N), + function() + local clone = evo.clone + + local prefab = evo.spawn { [D1] = true, [D2] = true, [D3] = true, [D4] = true, [D5] = true } + + for _ = 1, N do + clone(prefab) + end + + evo.batch_destroy(QD1) end) print '----------------------------------------' -basics.describe_bench(string.format('Clone Benchmarks: Simple Clone | %d entities with 1 required component', N), +basics.describe_bench( + string.format('Clone Benchmarks: Simple Clone | %d entities with 1 required component', N), function() local clone = evo.clone - local prefab = evo.spawn { [R1] = true } + local prefab = evo.spawn { [RF1] = true } for _ = 1, N do clone(prefab) end - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Simple Defer Clone | %d entities with 1 required component', N), +basics.describe_bench( + string.format('Clone Benchmarks: Simple Defer Clone | %d entities with 1 required component', N), function() local clone = evo.clone - local prefab = evo.spawn { [R1] = true } + local prefab = evo.spawn { [RF1] = true } evo.defer() for _ = 1, N do @@ -126,27 +194,43 @@ basics.describe_bench(string.format('Clone Benchmarks: Simple Defer Clone | %d e end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Simple Clone | %d entities with 3 required components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Simple Clone With Defaults | %d entities with 1 required component', N), function() local clone = evo.clone - local prefab = evo.spawn { [R3] = true } + local prefab = evo.spawn { [RD1] = true } for _ = 1, N do clone(prefab) end - evo.batch_destroy(Q1) + evo.batch_destroy(QD1) end) -basics.describe_bench(string.format('Clone Benchmarks: Simple Defer Clone | %d entities with 3 required components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Simple Clone | %d entities with 3 required components', N), function() local clone = evo.clone - local prefab = evo.spawn { [R3] = true } + local prefab = evo.spawn { [RF123] = true } + + for _ = 1, N do + clone(prefab) + end + + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Clone Benchmarks: Simple Defer Clone | %d entities with 3 required components', N), + function() + local clone = evo.clone + + local prefab = evo.spawn { [RF123] = true } evo.defer() for _ = 1, N do @@ -154,27 +238,43 @@ basics.describe_bench(string.format('Clone Benchmarks: Simple Defer Clone | %d e end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Simple Clone | %d entities with 5 required components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Simple Clone With Defaults | %d entities with 3 required components', N), function() local clone = evo.clone - local prefab = evo.spawn { [R5] = true } + local prefab = evo.spawn { [RD123] = true } for _ = 1, N do clone(prefab) end - evo.batch_destroy(Q1) + evo.batch_destroy(QD1) end) -basics.describe_bench(string.format('Clone Benchmarks: Simple Defer Clone | %d entities with 5 required components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Simple Clone | %d entities with 5 required components', N), function() local clone = evo.clone - local prefab = evo.spawn { [R5] = true } + local prefab = evo.spawn { [RF12345] = true } + + for _ = 1, N do + clone(prefab) + end + + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Clone Benchmarks: Simple Defer Clone | %d entities with 5 required components', N), + function() + local clone = evo.clone + + local prefab = evo.spawn { [RF12345] = true } evo.defer() for _ = 1, N do @@ -182,12 +282,27 @@ basics.describe_bench(string.format('Clone Benchmarks: Simple Defer Clone | %d e end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Clone Benchmarks: Simple Clone With Defaults | %d entities with 5 required components', N), + function() + local clone = evo.clone + + local prefab = evo.spawn { [RD12345] = true } + + for _ = 1, N do + clone(prefab) + end + + evo.batch_destroy(QD1) end) print '----------------------------------------' -basics.describe_bench(string.format('Clone Benchmarks: Multi Clone | %d entities with 1 component', N), +basics.describe_bench( + string.format('Clone Benchmarks: Multi Clone | %d entities with 1 component', N), function() local multi_clone = evo.multi_clone @@ -195,10 +310,11 @@ basics.describe_bench(string.format('Clone Benchmarks: Multi Clone | %d entities multi_clone(N, prefab) - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 1 component', N), +basics.describe_bench( + string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 1 component', N), function() local multi_clone = evo.multi_clone @@ -208,10 +324,23 @@ basics.describe_bench(string.format('Clone Benchmarks: Multi Defer Clone | %d en multi_clone(N, prefab) evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Multi Clone | %d entities with 3 components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Multi Clone With Defaults | %d entities with 1 component', N), + function() + local multi_clone = evo.multi_clone + + local prefab = evo.spawn { [D1] = true } + + multi_clone(N, prefab) + + evo.batch_destroy(QD1) + end) + +basics.describe_bench( + string.format('Clone Benchmarks: Multi Clone | %d entities with 3 components', N), function() local multi_clone = evo.multi_clone @@ -219,10 +348,11 @@ basics.describe_bench(string.format('Clone Benchmarks: Multi Clone | %d entities multi_clone(N, prefab) - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 3 components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 3 components', N), function() local multi_clone = evo.multi_clone @@ -232,10 +362,23 @@ basics.describe_bench(string.format('Clone Benchmarks: Multi Defer Clone | %d en multi_clone(N, prefab) evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Multi Clone | %d entities with 5 components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Multi Clone With Defaults | %d entities with 3 components', N), + function() + local multi_clone = evo.multi_clone + + local prefab = evo.spawn { [D1] = true, [D2] = true, [D3] = true } + + multi_clone(N, prefab) + + evo.batch_destroy(QD1) + end) + +basics.describe_bench( + string.format('Clone Benchmarks: Multi Clone | %d entities with 5 components', N), function() local multi_clone = evo.multi_clone @@ -243,10 +386,11 @@ basics.describe_bench(string.format('Clone Benchmarks: Multi Clone | %d entities multi_clone(N, prefab) - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 5 components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 5 components', N), function() local multi_clone = evo.multi_clone @@ -256,79 +400,133 @@ basics.describe_bench(string.format('Clone Benchmarks: Multi Defer Clone | %d en multi_clone(N, prefab) evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Clone Benchmarks: Multi Clone With Defaults | %d entities with 5 components', N), + function() + local multi_clone = evo.multi_clone + + local prefab = evo.spawn { [D1] = true, [D2] = true, [D3] = true, [D4] = true, [D5] = true } + + multi_clone(N, prefab) + + evo.batch_destroy(QD1) end) print '----------------------------------------' -basics.describe_bench(string.format('Clone Benchmarks: Multi Clone | %d entities with 1 required component', N), +basics.describe_bench( + string.format('Clone Benchmarks: Multi Clone | %d entities with 1 required component', N), function() local multi_clone = evo.multi_clone - local prefab = evo.spawn { [R1] = true } + local prefab = evo.spawn { [RF1] = true } multi_clone(N, prefab) - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 1 required component', N), +basics.describe_bench( + string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 1 required component', N), function() local multi_clone = evo.multi_clone - local prefab = evo.spawn { [R1] = true } + local prefab = evo.spawn { [RF1] = true } evo.defer() multi_clone(N, prefab) evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Multi Clone | %d entities with 3 required components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Multi Clone With Defaults | %d entities with 1 required component', N), function() local multi_clone = evo.multi_clone - local prefab = evo.spawn { [R3] = true } + local prefab = evo.spawn { [RD1] = true } multi_clone(N, prefab) - evo.batch_destroy(Q1) + evo.batch_destroy(QD1) end) -basics.describe_bench(string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 3 required components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Multi Clone | %d entities with 3 required components', N), function() local multi_clone = evo.multi_clone - local prefab = evo.spawn { [R3] = true } + local prefab = evo.spawn { [RF123] = true } + + multi_clone(N, prefab) + + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 3 required components', N), + function() + local multi_clone = evo.multi_clone + + local prefab = evo.spawn { [RF123] = true } evo.defer() multi_clone(N, prefab) evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Clone Benchmarks: Multi Clone | %d entities with 5 required components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Multi Clone With Defaults | %d entities with 3 required components', N), function() local multi_clone = evo.multi_clone - local prefab = evo.spawn { [R5] = true } + local prefab = evo.spawn { [RD123] = true } multi_clone(N, prefab) - evo.batch_destroy(Q1) + evo.batch_destroy(QD1) end) -basics.describe_bench(string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 5 required components', N), +basics.describe_bench( + string.format('Clone Benchmarks: Multi Clone | %d entities with 5 required components', N), function() local multi_clone = evo.multi_clone - local prefab = evo.spawn { [R5] = true } + local prefab = evo.spawn { [RF12345] = true } + + multi_clone(N, prefab) + + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Clone Benchmarks: Multi Defer Clone | %d entities with 5 required components', N), + function() + local multi_clone = evo.multi_clone + + local prefab = evo.spawn { [RF12345] = true } evo.defer() multi_clone(N, prefab) evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Clone Benchmarks: Multi Clone With Defaults | %d entities with 5 required components', N), + function() + local multi_clone = evo.multi_clone + + local prefab = evo.spawn { [RD12345] = true } + + multi_clone(N, prefab) + + evo.batch_destroy(QD1) end) diff --git a/develop/benchmarks/spawn_bmarks.lua b/develop/benchmarks/spawn_bmarks.lua index 28d6ba9..5725425 100644 --- a/develop/benchmarks/spawn_bmarks.lua +++ b/develop/benchmarks/spawn_bmarks.lua @@ -6,16 +6,35 @@ evo.debug_mode(false) local N = 1000 local F1, F2, F3, F4, F5 = evo.id(5) +local D1, D2, D3, D4, D5 = evo.id(5) -local Q1 = evo.builder():include(F1):spawn() +evo.set(D1, evo.DEFAULT, true) +evo.set(D2, evo.DEFAULT, true) +evo.set(D3, evo.DEFAULT, true) +evo.set(D4, evo.DEFAULT, true) +evo.set(D5, evo.DEFAULT, true) -local R1 = evo.builder():require(F1):spawn() -local R3 = evo.builder():require(F1, F2, F3):spawn() -local R5 = evo.builder():require(F1, F2, F3, F4, F5):spawn() +evo.set(D1, evo.DUPLICATE, function(v) return not v end) +evo.set(D2, evo.DUPLICATE, function(v) return not v end) +evo.set(D3, evo.DUPLICATE, function(v) return not v end) +evo.set(D4, evo.DUPLICATE, function(v) return not v end) +evo.set(D5, evo.DUPLICATE, function(v) return not v end) + +local QF1 = evo.builder():include(F1):spawn() +local QD1 = evo.builder():include(D1):spawn() + +local RF1 = evo.builder():require(F1):spawn() +local RF123 = evo.builder():require(F1, F2, F3):spawn() +local RF12345 = evo.builder():require(F1, F2, F3, F4, F5):spawn() + +local RD1 = evo.builder():require(D1):spawn() +local RD123 = evo.builder():require(D1, D2, D3):spawn() +local RD12345 = evo.builder():require(D1, D2, D3, D4, D5):spawn() print '----------------------------------------' -basics.describe_bench(string.format('Spawn Benchmarks: Simple Spawn | %d entities with 1 component', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Spawn | %d entities with 1 component', N), function() local spawn = evo.spawn @@ -25,10 +44,11 @@ basics.describe_bench(string.format('Spawn Benchmarks: Simple Spawn | %d entitie spawn(components) end - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Simple Defer Spawn | %d entities with 1 component', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Defer Spawn | %d entities with 1 component', N), function() local spawn = evo.spawn @@ -40,10 +60,25 @@ basics.describe_bench(string.format('Spawn Benchmarks: Simple Defer Spawn | %d e end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Simple Spawn | %d entities with 3 components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Spawn With Defaults | %d entities with 1 component', N), + function() + local spawn = evo.spawn + + local components = { [D1] = true } + + for _ = 1, N do + spawn(components) + end + + evo.batch_destroy(QD1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Spawn | %d entities with 3 components', N), function() local spawn = evo.spawn @@ -53,10 +88,11 @@ basics.describe_bench(string.format('Spawn Benchmarks: Simple Spawn | %d entitie spawn(components) end - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Simple Defer Spawn | %d entities with 3 components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Defer Spawn | %d entities with 3 components', N), function() local spawn = evo.spawn @@ -68,10 +104,25 @@ basics.describe_bench(string.format('Spawn Benchmarks: Simple Defer Spawn | %d e end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Simple Spawn | %d entities with 5 components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Spawn With Defaults | %d entities with 3 components', N), + function() + local spawn = evo.spawn + + local components = { [D1] = true, [D2] = true, [D3] = true } + + for _ = 1, N do + spawn(components) + end + + evo.batch_destroy(QD1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Spawn | %d entities with 5 components', N), function() local spawn = evo.spawn @@ -81,10 +132,11 @@ basics.describe_bench(string.format('Spawn Benchmarks: Simple Spawn | %d entitie spawn(components) end - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Simple Defer Spawn | %d entities with 5 components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Defer Spawn | %d entities with 5 components', N), function() local spawn = evo.spawn @@ -96,29 +148,45 @@ basics.describe_bench(string.format('Spawn Benchmarks: Simple Defer Spawn | %d e end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Spawn With Defaults | %d entities with 5 components', N), + function() + local spawn = evo.spawn + + local components = { [D1] = true, [D2] = true, [D3] = true, [D4] = true, [D5] = true } + + for _ = 1, N do + spawn(components) + end + + evo.batch_destroy(QD1) end) print '----------------------------------------' -basics.describe_bench(string.format('Spawn Benchmarks: Simple Spawn | %d entities with 1 required component', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Spawn | %d entities with 1 required component', N), function() local spawn = evo.spawn - local components = { [R1] = true } + local components = { [RF1] = true } for _ = 1, N do spawn(components) end - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Simple Defer Spawn | %d entities with 1 required component', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Defer Spawn | %d entities with 1 required component', N), function() local spawn = evo.spawn - local components = { [R1] = true } + local components = { [RF1] = true } evo.defer() for _ = 1, N do @@ -126,27 +194,43 @@ basics.describe_bench(string.format('Spawn Benchmarks: Simple Defer Spawn | %d e end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Simple Spawn | %d entities with 3 required components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Spawn With Defaults | %d entities with 1 required component', N), function() local spawn = evo.spawn - local components = { [R3] = true } + local components = { [RD1] = true } for _ = 1, N do spawn(components) end - evo.batch_destroy(Q1) + evo.batch_destroy(QD1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Simple Defer Spawn | %d entities with 3 required components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Spawn | %d entities with 3 required components', N), function() local spawn = evo.spawn - local components = { [R3] = true } + local components = { [RF123] = true } + + for _ = 1, N do + spawn(components) + end + + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Defer Spawn | %d entities with 3 required components', N), + function() + local spawn = evo.spawn + + local components = { [RF123] = true } evo.defer() for _ = 1, N do @@ -154,27 +238,43 @@ basics.describe_bench(string.format('Spawn Benchmarks: Simple Defer Spawn | %d e end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Simple Spawn | %d entities with 5 required components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Spawn With Defaults | %d entities with 3 required components', N), function() local spawn = evo.spawn - local components = { [R5] = true } + local components = { [RD123] = true } for _ = 1, N do spawn(components) end - evo.batch_destroy(Q1) + evo.batch_destroy(QD1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Simple Defer Spawn | %d entities with 5 required components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Spawn | %d entities with 5 required components', N), function() local spawn = evo.spawn - local components = { [R5] = true } + local components = { [RF12345] = true } + + for _ = 1, N do + spawn(components) + end + + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Defer Spawn | %d entities with 5 required components', N), + function() + local spawn = evo.spawn + + local components = { [RF12345] = true } evo.defer() for _ = 1, N do @@ -182,12 +282,27 @@ basics.describe_bench(string.format('Spawn Benchmarks: Simple Defer Spawn | %d e end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Simple Spawn With Defaults | %d entities with 5 required components', N), + function() + local spawn = evo.spawn + + local components = { [RD12345] = true } + + for _ = 1, N do + spawn(components) + end + + evo.batch_destroy(QD1) end) print '----------------------------------------' -basics.describe_bench(string.format('Spawn Benchmarks: Builder Spawn | %d entities with 1 component', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Spawn | %d entities with 1 component', N), function() local builder = evo.builder():set(F1) @@ -195,10 +310,11 @@ basics.describe_bench(string.format('Spawn Benchmarks: Builder Spawn | %d entiti builder:spawn() end - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Builder Defer Spawn | %d entities with 1 component', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Defer Spawn | %d entities with 1 component', N), function() local builder = evo.builder():set(F1) @@ -208,10 +324,23 @@ basics.describe_bench(string.format('Spawn Benchmarks: Builder Defer Spawn | %d end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Builder Spawn | %d entities with 3 components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Spawn With Defaults | %d entities with 1 component', N), + function() + local builder = evo.builder():set(D1) + + for _ = 1, N do + builder:spawn() + end + + evo.batch_destroy(QD1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Spawn | %d entities with 3 components', N), function() local builder = evo.builder():set(F1):set(F2):set(F3) @@ -219,10 +348,11 @@ basics.describe_bench(string.format('Spawn Benchmarks: Builder Spawn | %d entiti builder:spawn() end - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Builder Defer Spawn | %d entities with 3 components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Defer Spawn | %d entities with 3 components', N), function() local builder = evo.builder():set(F1):set(F2):set(F3) @@ -232,10 +362,23 @@ basics.describe_bench(string.format('Spawn Benchmarks: Builder Defer Spawn | %d end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Builder Spawn | %d entities with 5 components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Spawn With Defaults | %d entities with 3 components', N), + function() + local builder = evo.builder():set(D1):set(D2):set(D3) + + for _ = 1, N do + builder:spawn() + end + + evo.batch_destroy(QD1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Spawn | %d entities with 5 components', N), function() local builder = evo.builder():set(F1):set(F2):set(F3):set(F4):set(F5) @@ -243,10 +386,11 @@ basics.describe_bench(string.format('Spawn Benchmarks: Builder Spawn | %d entiti builder:spawn() end - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Builder Defer Spawn | %d entities with 5 components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Defer Spawn | %d entities with 5 components', N), function() local builder = evo.builder():set(F1):set(F2):set(F3):set(F4):set(F5) @@ -256,25 +400,39 @@ basics.describe_bench(string.format('Spawn Benchmarks: Builder Defer Spawn | %d end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Spawn With Defaults | %d entities with 5 components', N), + function() + local builder = evo.builder():set(D1):set(D2):set(D3):set(D4):set(D5) + + for _ = 1, N do + builder:spawn() + end + + evo.batch_destroy(QD1) end) print '----------------------------------------' -basics.describe_bench(string.format('Spawn Benchmarks: Builder Spawn | %d entities with 1 required component', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Spawn | %d entities with 1 required component', N), function() - local builder = evo.builder():set(R1) + local builder = evo.builder():set(RF1) for _ = 1, N do builder:spawn() end - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Builder Defer Spawn | %d entities with 1 required component', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Defer Spawn | %d entities with 1 required component', N), function() - local builder = evo.builder():set(R1) + local builder = evo.builder():set(RF1) evo.defer() for _ = 1, N do @@ -282,23 +440,37 @@ basics.describe_bench(string.format('Spawn Benchmarks: Builder Defer Spawn | %d end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Builder Spawn | %d entities with 3 required components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Spawn With Defaults | %d entities with 1 required component', N), function() - local builder = evo.builder():set(R3) + local builder = evo.builder():set(RD1) for _ = 1, N do builder:spawn() end - evo.batch_destroy(Q1) + evo.batch_destroy(QD1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Builder Defer Spawn | %d entities with 3 required components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Spawn | %d entities with 3 required components', N), function() - local builder = evo.builder():set(R3) + local builder = evo.builder():set(RF123) + + for _ = 1, N do + builder:spawn() + end + + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Defer Spawn | %d entities with 3 required components', N), + function() + local builder = evo.builder():set(RF123) evo.defer() for _ = 1, N do @@ -306,23 +478,37 @@ basics.describe_bench(string.format('Spawn Benchmarks: Builder Defer Spawn | %d end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Builder Spawn | %d entities with 5 required components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Spawn With Defaults | %d entities with 3 required components', N), function() - local builder = evo.builder():set(R5) + local builder = evo.builder():set(RD123) for _ = 1, N do builder:spawn() end - evo.batch_destroy(Q1) + evo.batch_destroy(QD1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Builder Defer Spawn | %d entities with 5 required components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Spawn | %d entities with 5 required components', N), function() - local builder = evo.builder():set(R5) + local builder = evo.builder():set(RF12345) + + for _ = 1, N do + builder:spawn() + end + + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Defer Spawn | %d entities with 5 required components', N), + function() + local builder = evo.builder():set(RF12345) evo.defer() for _ = 1, N do @@ -330,12 +516,25 @@ basics.describe_bench(string.format('Spawn Benchmarks: Builder Defer Spawn | %d end evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Builder Spawn With Defaults | %d entities with 5 required components', N), + function() + local builder = evo.builder():set(RD12345) + + for _ = 1, N do + builder:spawn() + end + + evo.batch_destroy(QD1) end) print '----------------------------------------' -basics.describe_bench(string.format('Spawn Benchmarks: Multi Spawn | %d entities with 1 component', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Spawn | %d entities with 1 component', N), function() local multi_spawn = evo.multi_spawn @@ -343,10 +542,11 @@ basics.describe_bench(string.format('Spawn Benchmarks: Multi Spawn | %d entities multi_spawn(N, components) - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 1 component', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 1 component', N), function() local multi_spawn = evo.multi_spawn @@ -356,10 +556,23 @@ basics.describe_bench(string.format('Spawn Benchmarks: Multi Defer Spawn | %d en multi_spawn(N, components) evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Multi Spawn | %d entities with 3 components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Spawn With Defaults | %d entities with 1 component', N), + function() + local multi_spawn = evo.multi_spawn + + local components = { [D1] = true } + + multi_spawn(N, components) + + evo.batch_destroy(QD1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Spawn | %d entities with 3 components', N), function() local multi_spawn = evo.multi_spawn @@ -367,10 +580,11 @@ basics.describe_bench(string.format('Spawn Benchmarks: Multi Spawn | %d entities multi_spawn(N, components) - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 3 components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 3 components', N), function() local multi_spawn = evo.multi_spawn @@ -380,10 +594,23 @@ basics.describe_bench(string.format('Spawn Benchmarks: Multi Defer Spawn | %d en multi_spawn(N, components) evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Multi Spawn | %d entities with 5 components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Spawn With Defaults | %d entities with 3 components', N), + function() + local multi_spawn = evo.multi_spawn + + local components = { [D1] = true, [D2] = true, [D3] = true } + + multi_spawn(N, components) + + evo.batch_destroy(QD1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Spawn | %d entities with 5 components', N), function() local multi_spawn = evo.multi_spawn @@ -391,10 +618,11 @@ basics.describe_bench(string.format('Spawn Benchmarks: Multi Spawn | %d entities multi_spawn(N, components) - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 5 components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 5 components', N), function() local multi_spawn = evo.multi_spawn @@ -404,12 +632,25 @@ basics.describe_bench(string.format('Spawn Benchmarks: Multi Defer Spawn | %d en multi_spawn(N, components) evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Spawn With Defaults | %d entities with 5 components', N), + function() + local multi_spawn = evo.multi_spawn + + local components = { [D1] = true, [D2] = true, [D3] = true, [D4] = true, [D5] = true } + + multi_spawn(N, components) + + evo.batch_destroy(QD1) end) print '----------------------------------------' -basics.describe_bench(string.format('Spawn Benchmarks: Multi Spawn | %d entities with 1 required component', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Spawn | %d entities with 1 required component', N), function() local multi_spawn = evo.multi_spawn @@ -417,10 +658,11 @@ basics.describe_bench(string.format('Spawn Benchmarks: Multi Spawn | %d entities multi_spawn(N, components) - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 1 required component', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 1 required component', N), function() local multi_spawn = evo.multi_spawn @@ -430,53 +672,93 @@ basics.describe_bench(string.format('Spawn Benchmarks: Multi Defer Spawn | %d en multi_spawn(N, components) evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Multi Spawn | %d entities with 3 required components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Spawn With Defaults | %d entities with 1 required component', N), function() local multi_spawn = evo.multi_spawn - local components = { [R3] = true } + local components = { [D1] = true } multi_spawn(N, components) - evo.batch_destroy(Q1) + evo.batch_destroy(QD1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 3 required components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Spawn | %d entities with 3 required components', N), function() local multi_spawn = evo.multi_spawn - local components = { [R3] = true } + local components = { [RF123] = true } + + multi_spawn(N, components) + + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 3 required components', N), + function() + local multi_spawn = evo.multi_spawn + + local components = { [RF123] = true } evo.defer() multi_spawn(N, components) evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Multi Spawn | %d entities with 5 required components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Spawn With Defaults | %d entities with 3 required components', N), function() local multi_spawn = evo.multi_spawn - local components = { [R5] = true } + local components = { [RD123] = true } multi_spawn(N, components) - evo.batch_destroy(Q1) + evo.batch_destroy(QD1) end) -basics.describe_bench(string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 5 required components', N), +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Spawn | %d entities with 5 required components', N), function() local multi_spawn = evo.multi_spawn - local components = { [R5] = true } + local components = { [RF12345] = true } + + multi_spawn(N, components) + + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Defer Spawn | %d entities with 5 required components', N), + function() + local multi_spawn = evo.multi_spawn + + local components = { [RF12345] = true } evo.defer() multi_spawn(N, components) evo.commit() - evo.batch_destroy(Q1) + evo.batch_destroy(QF1) + end) + +basics.describe_bench( + string.format('Spawn Benchmarks: Multi Spawn With Defaults | %d entities with 5 required components', N), + function() + local multi_spawn = evo.multi_spawn + + local components = { [RD12345] = true } + + multi_spawn(N, components) + + evo.batch_destroy(QD1) end)