@@ -610,28 +610,6 @@ basics.describe_bench(string.format('create and destroy %d entities with 5 compo
610610
611611print ' ----------------------------------------'
612612
613- basics .describe_bench (string.format (' create and destroy %d entities / spawn_at' , N ),
614- --- @param entities evolved.id[]
615- function (entities )
616- local destroy = evo .destroy
617- local spawn_at = evo .spawn_at
618-
619- local fragments = {}
620- local components = {}
621-
622- local chunk = nil
623-
624- for i = 1 , N do
625- entities [i ] = spawn_at (chunk , fragments , components )
626- end
627-
628- for i = # entities , 1 , - 1 do
629- destroy (entities [i ])
630- end
631- end , function ()
632- return {}
633- end )
634-
635613basics .describe_bench (string.format (' create and destroy %d entities with 1 components / spawn_at' , N ),
636614 --- @param entities evolved.id[]
637615 function (entities )
@@ -729,26 +707,103 @@ basics.describe_bench(string.format('create and destroy %d entities with 5 compo
729707
730708print ' ----------------------------------------'
731709
732- basics .describe_bench (string.format (' create and destroy %d entities / spawn_with ' , N ),
710+ basics .describe_bench (string.format (' create and destroy %d entities with 1 components / spawn_as ' , N ),
733711 --- @param entities evolved.id[]
734712 function (entities )
735- local destroy = evo .destroy
736- local spawn_with = evo .spawn_with
713+ local spawn_as = evo .spawn_as
714+
715+ local fragments = { F1 }
716+ local components = { true }
737717
738- local fragments = {}
739- local components = {}
718+ local prefab = evo .spawn_with (fragments , components )
740719
741720 for i = 1 , N do
742- entities [i ] = spawn_with ( fragments , components )
721+ entities [i ] = spawn_as ( prefab , fragments , components )
743722 end
744723
745- for i = # entities , 1 , - 1 do
746- destroy (entities [i ])
724+ evo .batch_destroy (Q1 )
725+ end , function ()
726+ return {}
727+ end )
728+
729+ basics .describe_bench (string.format (' create and destroy %d entities with 2 components / spawn_as' , N ),
730+ --- @param entities evolved.id[]
731+ function (entities )
732+ local spawn_as = evo .spawn_as
733+
734+ local fragments = { F1 , F2 }
735+ local components = { true , true }
736+
737+ local prefab = evo .spawn_with (fragments , components )
738+
739+ for i = 1 , N do
740+ entities [i ] = spawn_as (prefab , fragments , components )
741+ end
742+
743+ evo .batch_destroy (Q1 )
744+ end , function ()
745+ return {}
746+ end )
747+
748+ basics .describe_bench (string.format (' create and destroy %d entities with 3 components / spawn_as' , N ),
749+ --- @param entities evolved.id[]
750+ function (entities )
751+ local spawn_as = evo .spawn_as
752+
753+ local fragments = { F1 , F2 , F3 }
754+ local components = { true , true , true }
755+
756+ local prefab = evo .spawn_with (fragments , components )
757+
758+ for i = 1 , N do
759+ entities [i ] = spawn_as (prefab , fragments , components )
760+ end
761+
762+ evo .batch_destroy (Q1 )
763+ end , function ()
764+ return {}
765+ end )
766+
767+ basics .describe_bench (string.format (' create and destroy %d entities with 4 components / spawn_as' , N ),
768+ --- @param entities evolved.id[]
769+ function (entities )
770+ local spawn_as = evo .spawn_as
771+
772+ local fragments = { F1 , F2 , F3 , F4 }
773+ local components = { true , true , true , true }
774+
775+ local prefab = evo .spawn_with (fragments , components )
776+
777+ for i = 1 , N do
778+ entities [i ] = spawn_as (prefab , fragments , components )
779+ end
780+
781+ evo .batch_destroy (Q1 )
782+ end , function ()
783+ return {}
784+ end )
785+
786+ basics .describe_bench (string.format (' create and destroy %d entities with 5 components / spawn_as' , N ),
787+ --- @param entities evolved.id[]
788+ function (entities )
789+ local spawn_as = evo .spawn_as
790+
791+ local fragments = { F1 , F2 , F3 , F4 , F5 }
792+ local components = { true , true , true , true , true }
793+
794+ local prefab = evo .spawn_with (fragments , components )
795+
796+ for i = 1 , N do
797+ entities [i ] = spawn_as (prefab , fragments , components )
747798 end
799+
800+ evo .batch_destroy (Q1 )
748801 end , function ()
749802 return {}
750803 end )
751804
805+ print ' ----------------------------------------'
806+
752807basics .describe_bench (string.format (' create and destroy %d entities with 1 components / spawn_with' , N ),
753808 --- @param entities evolved.id[]
754809 function (entities )
0 commit comments