-
-
Notifications
You must be signed in to change notification settings - Fork 140
Benchmark
genar edited this page Dec 20, 2022
·
6 revisions
The current Benchmark tested a bunch of different iterations and acess techniques. However the most interesting one is the QueryBenchmark
.
It tests world.Query
against world.HPQuery
and a world.Query(in desc, (in Entity) => { entity.Get<T>... }
variant.
public struct Transform{ float x; float y; float z; }
public struct Velocity{ float x; float y; }
The used structs are actually quite big, the smaller the components, the faster the query. However i wanted to create a realistic approach and therefore used a combination of Transform and Velocity.
Method | Amount | Mean | Error | StdDev | CacheMisses/Op | Allocated |
---|---|---|---|---|---|---|
WorldEntityQuery | 10000 | 147.660 us | 13.2838 us | 0.7281 us | 746 | - |
Query | 10000 | 20.159 us | 1.4188 us | 0.0778 us | 103 | - |
EntityQuery | 10000 | 17.711 us | 1.1311 us | 0.0620 us | 49 | - |
StructQuery | 10000 | 7.767 us | 0.1572 us | 0.0086 us | 7 | - |
StructEntityQuery | 10000 | 7.338 us | 1.7188 us | 0.0942 us | 12 | - |
WorldEntityQuery | 100000 | 1,726.959 us | 3,058.5935 us | 167.6518 us | 11,761 | - |
Query | 100000 | 203.555 us | 4.6038 us | 0.2523 us | 2,977 | - |
EntityQuery | 100000 | 228.222 us | 17.4030 us | 0.9539 us | 2,708 | - |
StructQuery | 100000 | 115.466 us | 8.8355 us | 0.4843 us | 2,726 | - |
StructEntityQuery | 100000 | 76.823 us | 2.1875 us | 0.1199 us | 2,544 | - |
WorldEntityQuery | 1000000 | 20,419.798 us | 4,491.2760 us | 246.1820 us | 90,624 | - |
Query | 1000000 | 2,679.153 us | 35.1696 us | 1.9278 us | 28,579 | - |
EntityQuery | 1000000 | 2,462.296 us | 322.4767 us | 17.6760 us | 28,113 | - |
StructQuery | 1000000 | 1,514.479 us | 296.5311 us | 16.2539 us | 29,723 | - |
StructEntityQuery | 1000000 | 1,483.142 us | 329.9446 us | 18.0854 us | 31,272 | - |
Legends
- amount : Value of the 'amount' parameter
- Mean : Arithmetic mean of all measurements
- Error : Half of 99.9% confidence interval
- StdDev : Standard deviation of all measurements
- Median : Value separating the higher half of all measurements (50th percentile)
- Allocated : Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)
- 1 μs : 1 Microsecond (0.000001 sec)