mirror of
				https://github.com/Ukendio/jecs.git
				synced 2025-11-04 10:59:18 +00:00 
			
		
		
		
	world:target bench
This commit is contained in:
		
							parent
							
								
									b58d60e8e1
								
							
						
					
					
						commit
						2751a3d939
					
				
					 1 changed files with 24 additions and 0 deletions
				
			
		| 
						 | 
					@ -102,6 +102,30 @@ do TITLE "get"
 | 
				
			||||||
	end)
 | 
						end)
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					do TITLE "target"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						BENCH("1st target", function()
 | 
				
			||||||
 | 
							local world = jecs.World.new()
 | 
				
			||||||
 | 
							local A, B, C, D = world:entity(), world:entity(), world:entity(), world:entity()
 | 
				
			||||||
 | 
							local entities = table.create(N)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							for i = 1, N do
 | 
				
			||||||
 | 
								local ent = world:entity()
 | 
				
			||||||
 | 
								entities[i] = ent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								world:set(ent, pair(A, A))
 | 
				
			||||||
 | 
								world:set(ent, pair(A, B))
 | 
				
			||||||
 | 
								world:set(ent, pair(A, C))
 | 
				
			||||||
 | 
								world:set(ent, pair(A, D))
 | 
				
			||||||
 | 
							end	
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							for i = 1, START(N) do
 | 
				
			||||||
 | 
								world:target(entities[i], A)
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
--- this benchmark is used to view how fragmentation affects query performance
 | 
					--- this benchmark is used to view how fragmentation affects query performance
 | 
				
			||||||
--- we use this by determining how many entities should fit per arcehtype, instead
 | 
					--- we use this by determining how many entities should fit per arcehtype, instead
 | 
				
			||||||
--- of creating x amount of archetypes. this would scale better with any amount of
 | 
					--- of creating x amount of archetypes. this would scale better with any amount of
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue