Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement paged SparseArray #3813

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

james7132
Copy link
Member

Objective

Reduce the memory usage of SparseArray when very large indicies are used.

Solution

Replace the current backing Vec to hold Option<Box<[Option<V>; PAGE_SIZE]>> instead of just Option<V>. Any pages that have no corresponding elements are set to None, and a page is allocated only when it becomes populated. In the scenarios where the vast majority of the elements are None, as expected of SparseSets, this can save a significant amount of memory.

This PR contains one unsafe block to get around the array initialization limitations of Rust to create new pages. By default, Option always implements Default, returning None, but the array Default impl only goes up to a size of 32.
The page size is set to 64 elements per page.

Pros

  • Saves significant amounts of memory for SparseArrays/SparseSets with a much higher maximum index relative to the number of elements actually held in the array.
  • Page based allocation may save time spent resizing the underlying Vec in cases where a low maximum index increases quickly.

Cons

  • Adds overhead to all SparseArray accesses/mutations. (TODO: Benchmark)
  • May cause more memory fragmentation with large numbers of small allocations (a 64-element u64 page is 0.5KB).

This can be used alongside #3678, and/or #2104 to further reduce memory usage.

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Jan 30, 2022
@james7132 james7132 added A-ECS Entities, components, systems, and events and removed S-Needs-Triage This issue needs to be labelled labels Jan 30, 2022
@james7132
Copy link
Member Author

I could add unsafe unchecked gets while indexing into individual pages, but I think that's outside of the scope of this initial PR, adds a lot more unsafe noise, and the bounds check is (hopefully) optimized out in release builds. Unless requested, I will probably just make a followup PR to add that in.

Copy link
Contributor

@jakobhellermann jakobhellermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the make_page function is sound now. The tradeoffs of whether this is worth it I can't comment on.

Out of curiosity I compared the assembly to a simple

fn make_page() -> Box<[Option<V>; PAGE_SIZE>] {
  Box::new([None; PAGE_SIZE])
}

and with opt-level = 2 and V=usize it results in the exact same assembly:
https://godbolt.org/z/3T47bMrre

With a page size of 1024 however or type V = [u8; 12] (if I'm reading the assembly correct) the array is written to the stack and then memcpyd to the allocated box.

@alice-i-cecile alice-i-cecile added the C-Performance A change motivated by improving speed, memory usage or compile times label May 16, 2022

#[derive(Debug)]
pub struct SparseArray<I, V = I> {
values: Vec<Option<V>>,
values: Vec<Option<Box<[Option<V>; PAGE_SIZE]>>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a comment linking back to the PR; the details are relatively arcane and stumbling across this type will be intimidating.

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look fine to me, but like always, I'd like to see both performance and memory benchmarks here.

@alice-i-cecile alice-i-cecile added the S-Needs-Benchmarking This set of changes needs performance benchmarking to double-check that they help label May 18, 2022
@james7132
Copy link
Member Author

james7132 commented Jun 1, 2022

Ran some basic benchmarks. The results are, as expected, rather poor. This hurts sparse iteration/fetches the most, with a 8-17% regression in these benchmarks, and since we're using SparseSet to back a lot of our other storage, it affected quite a bit more too. We may want to wait on the other ID size optimization PRs to be merged in before rerunning these benchmarks and attempting to merge this.

group                                                    main                                     paged-sparse-array
-----                                                    ----                                     ------------------
add_remove_component/sparse_set                          1.00  1326.2±83.48µs        ? ?/sec      1.07  1415.6±76.52µs        ? ?/sec
add_remove_component/table                               1.00  1667.2±95.69µs        ? ?/sec      1.01  1684.9±23.56µs        ? ?/sec
add_remove_component_big/sparse_set                      1.00  1533.4±307.70µs        ? ?/sec     1.02  1567.6±419.40µs        ? ?/sec
add_remove_component_big/table                           1.05      3.5±0.45ms        ? ?/sec      1.00      3.3±0.13ms        ? ?/sec
added_archetypes/archetype_count/100                     1.00  1305.4±41.35µs        ? ?/sec      1.09  1425.8±31.53µs        ? ?/sec
added_archetypes/archetype_count/1000                    1.00  1941.2±96.01µs        ? ?/sec      1.24      2.4±0.15ms        ? ?/sec
added_archetypes/archetype_count/10000                   1.00     18.1±2.15ms        ? ?/sec      1.10     19.9±0.95ms        ? ?/sec
added_archetypes/archetype_count/200                     1.00  1381.9±47.51µs        ? ?/sec      1.13  1555.7±41.37µs        ? ?/sec
added_archetypes/archetype_count/2000                    1.00      4.1±0.19ms        ? ?/sec      1.07      4.4±0.22ms        ? ?/sec
added_archetypes/archetype_count/500                     1.00  1584.1±48.62µs        ? ?/sec      1.18  1871.4±69.66µs        ? ?/sec
added_archetypes/archetype_count/5000                    1.00      8.9±0.51ms        ? ?/sec      1.11      9.8±0.76ms        ? ?/sec
busy_systems/01x_entities_03_systems                     1.00     34.5±1.38µs        ? ?/sec      1.13     38.9±2.44µs        ? ?/sec
busy_systems/01x_entities_06_systems                     1.00     65.1±2.18µs        ? ?/sec      1.25     81.7±8.84µs        ? ?/sec
busy_systems/01x_entities_09_systems                     1.00    106.0±4.65µs        ? ?/sec      1.06    112.6±8.98µs        ? ?/sec
busy_systems/01x_entities_12_systems                     1.00    129.4±3.94µs        ? ?/sec      1.20   155.8±12.71µs        ? ?/sec
busy_systems/01x_entities_15_systems                     1.00    162.4±4.38µs        ? ?/sec      1.10    178.5±9.79µs        ? ?/sec
busy_systems/02x_entities_03_systems                     1.00     67.1±5.11µs        ? ?/sec      1.12     75.1±5.18µs        ? ?/sec
busy_systems/02x_entities_06_systems                     1.00    117.5±4.45µs        ? ?/sec      1.07    126.0±9.48µs        ? ?/sec
busy_systems/02x_entities_09_systems                     1.00    179.6±8.45µs        ? ?/sec      1.10   197.4±13.80µs        ? ?/sec
busy_systems/02x_entities_12_systems                     1.00    232.6±6.51µs        ? ?/sec      1.07   248.8±12.76µs        ? ?/sec
busy_systems/02x_entities_15_systems                     1.00   297.5±13.46µs        ? ?/sec      1.10   328.5±26.12µs        ? ?/sec
busy_systems/03x_entities_03_systems                     1.19    104.3±5.90µs        ? ?/sec      1.00     87.4±4.80µs        ? ?/sec
busy_systems/03x_entities_06_systems                     1.04   190.1±10.71µs        ? ?/sec      1.00   182.6±17.71µs        ? ?/sec
busy_systems/03x_entities_09_systems                     1.07   270.5±11.88µs        ? ?/sec      1.00   252.0±12.36µs        ? ?/sec
busy_systems/03x_entities_12_systems                     1.06   359.6±19.62µs        ? ?/sec      1.00   340.2±31.10µs        ? ?/sec
busy_systems/03x_entities_15_systems                     1.07   427.1±20.75µs        ? ?/sec      1.00   399.8±13.42µs        ? ?/sec
busy_systems/04x_entities_03_systems                     1.27   137.1±10.09µs        ? ?/sec      1.00    107.6±7.24µs        ? ?/sec
busy_systems/04x_entities_06_systems                     1.12   245.3±11.59µs        ? ?/sec      1.00   218.9±10.80µs        ? ?/sec
busy_systems/04x_entities_09_systems                     1.14   368.9±21.55µs        ? ?/sec      1.00   322.9±13.70µs        ? ?/sec
busy_systems/04x_entities_12_systems                     1.08   461.3±22.06µs        ? ?/sec      1.00   429.1±26.98µs        ? ?/sec
busy_systems/04x_entities_15_systems                     1.08   568.9±21.78µs        ? ?/sec      1.00   527.4±23.37µs        ? ?/sec
busy_systems/05x_entities_03_systems                     1.34   183.0±16.69µs        ? ?/sec      1.00    136.8±8.12µs        ? ?/sec
busy_systems/05x_entities_06_systems                     1.26   330.7±22.33µs        ? ?/sec      1.00    263.0±6.63µs        ? ?/sec
busy_systems/05x_entities_09_systems                     1.10   447.9±21.98µs        ? ?/sec      1.00   408.5±28.49µs        ? ?/sec
busy_systems/05x_entities_12_systems                     1.13   614.7±31.44µs        ? ?/sec      1.00   545.8±20.72µs        ? ?/sec
busy_systems/05x_entities_15_systems                     1.13   746.1±33.26µs        ? ?/sec      1.00   659.4±21.21µs        ? ?/sec
contrived/01x_entities_03_systems                        1.00     24.0±1.15µs        ? ?/sec      1.09     26.3±2.63µs        ? ?/sec
contrived/01x_entities_06_systems                        1.05     46.4±1.90µs        ? ?/sec      1.00     44.2±2.91µs        ? ?/sec
contrived/01x_entities_09_systems                        1.00     63.0±3.29µs        ? ?/sec      1.04     65.2±2.55µs        ? ?/sec
contrived/01x_entities_12_systems                        1.04     82.1±3.93µs        ? ?/sec      1.00     79.2±2.43µs        ? ?/sec
contrived/01x_entities_15_systems                        1.00    104.5±3.86µs        ? ?/sec      1.02    106.6±7.73µs        ? ?/sec
contrived/02x_entities_03_systems                        1.08     37.7±1.94µs        ? ?/sec      1.00     34.9±3.33µs        ? ?/sec
contrived/02x_entities_06_systems                        1.07     68.4±4.43µs        ? ?/sec      1.00     63.9±3.50µs        ? ?/sec
contrived/02x_entities_09_systems                        1.05     98.4±2.67µs        ? ?/sec      1.00     94.1±4.64µs        ? ?/sec
contrived/02x_entities_12_systems                        1.05   132.5±10.57µs        ? ?/sec      1.00    126.2±3.38µs        ? ?/sec
contrived/02x_entities_15_systems                        1.05    159.3±5.83µs        ? ?/sec      1.00    151.9±4.74µs        ? ?/sec
contrived/03x_entities_03_systems                        1.03     46.6±2.58µs        ? ?/sec      1.00     45.3±2.32µs        ? ?/sec
contrived/03x_entities_06_systems                        1.04     87.8±6.44µs        ? ?/sec      1.00     84.4±2.65µs        ? ?/sec
contrived/03x_entities_09_systems                        1.09   137.4±22.12µs        ? ?/sec      1.00    126.6±3.98µs        ? ?/sec
contrived/03x_entities_12_systems                        1.09    180.2±7.70µs        ? ?/sec      1.00    165.0±4.06µs        ? ?/sec
contrived/03x_entities_15_systems                        1.05   214.9±11.06µs        ? ?/sec      1.00    204.9±7.14µs        ? ?/sec
contrived/04x_entities_03_systems                        1.01     57.3±2.52µs        ? ?/sec      1.00     56.7±2.52µs        ? ?/sec
contrived/04x_entities_06_systems                        1.05    108.4±4.45µs        ? ?/sec      1.00    103.3±5.44µs        ? ?/sec
contrived/04x_entities_09_systems                        1.00    162.3±7.43µs        ? ?/sec      1.00   162.4±10.18µs        ? ?/sec
contrived/04x_entities_12_systems                        1.02    212.0±9.30µs        ? ?/sec      1.00    208.4±7.22µs        ? ?/sec
contrived/04x_entities_15_systems                        1.06    269.8±8.24µs        ? ?/sec      1.00    255.1±7.10µs        ? ?/sec
contrived/05x_entities_03_systems                        1.00     67.3±3.71µs        ? ?/sec      1.08     73.0±7.39µs        ? ?/sec
contrived/05x_entities_06_systems                        1.00    133.0±7.40µs        ? ?/sec      1.03   136.5±11.13µs        ? ?/sec
contrived/05x_entities_09_systems                        1.04    198.7±7.60µs        ? ?/sec      1.00    191.8±7.83µs        ? ?/sec
contrived/05x_entities_12_systems                        1.06   265.4±12.66µs        ? ?/sec      1.00   249.9±10.35µs        ? ?/sec
contrived/05x_entities_15_systems                        1.05   327.3±12.49µs        ? ?/sec      1.00   311.5±12.59µs        ? ?/sec
empty_commands/0_entities                                1.00      5.2±0.12ns        ? ?/sec      1.01      5.2±0.30ns        ? ?/sec
empty_systems/000_systems                                1.36  1980.0±251.38ns        ? ?/sec     1.00  1455.0±185.99ns        ? ?/sec
empty_systems/001_systems                                1.00      5.9±0.28µs        ? ?/sec      1.08      6.4±0.20µs        ? ?/sec
empty_systems/002_systems                                1.00      7.0±0.51µs        ? ?/sec      1.03      7.2±0.48µs        ? ?/sec
empty_systems/003_systems                                1.00      8.2±0.58µs        ? ?/sec      1.04      8.5±0.46µs        ? ?/sec
empty_systems/004_systems                                1.00      9.2±0.54µs        ? ?/sec      1.06      9.7±0.62µs        ? ?/sec
empty_systems/005_systems                                1.00     10.5±0.52µs        ? ?/sec      1.04     10.9±0.75µs        ? ?/sec
empty_systems/010_systems                                1.00     16.2±0.93µs        ? ?/sec      1.06     17.1±1.14µs        ? ?/sec
empty_systems/015_systems                                1.00     19.8±1.23µs        ? ?/sec      1.16     23.0±1.96µs        ? ?/sec
empty_systems/020_systems                                1.00     24.8±2.44µs        ? ?/sec      1.10     27.3±2.46µs        ? ?/sec
empty_systems/025_systems                                1.00     27.9±2.00µs        ? ?/sec      1.18     32.8±1.75µs        ? ?/sec
empty_systems/030_systems                                1.00     33.0±2.21µs        ? ?/sec      1.16     38.2±2.12µs        ? ?/sec
empty_systems/035_systems                                1.00     37.0±2.42µs        ? ?/sec      1.14     42.2±3.97µs        ? ?/sec
empty_systems/040_systems                                1.00     41.2±2.57µs        ? ?/sec      1.16     47.7±3.02µs        ? ?/sec
empty_systems/045_systems                                1.00     45.4±3.43µs        ? ?/sec      1.13     51.5±3.01µs        ? ?/sec
empty_systems/050_systems                                1.00     48.6±2.82µs        ? ?/sec      1.18     57.5±2.16µs        ? ?/sec
empty_systems/055_systems                                1.00     52.8±3.80µs        ? ?/sec      1.12     59.3±4.46µs        ? ?/sec
empty_systems/060_systems                                1.00     55.6±3.57µs        ? ?/sec      1.18     65.8±2.94µs        ? ?/sec
empty_systems/065_systems                                1.00     61.2±4.17µs        ? ?/sec      1.18     72.1±2.97µs        ? ?/sec
empty_systems/070_systems                                1.00     63.6±3.90µs        ? ?/sec      1.19     75.5±3.64µs        ? ?/sec
empty_systems/075_systems                                1.00     68.1±4.07µs        ? ?/sec      1.17     79.5±4.44µs        ? ?/sec
empty_systems/080_systems                                1.00     70.4±3.95µs        ? ?/sec      1.15     81.3±4.51µs        ? ?/sec
empty_systems/085_systems                                1.00     75.3±5.33µs        ? ?/sec      1.16     87.2±3.26µs        ? ?/sec
empty_systems/090_systems                                1.00     79.4±5.76µs        ? ?/sec      1.18     93.4±5.21µs        ? ?/sec
empty_systems/095_systems                                1.00     82.7±6.90µs        ? ?/sec      1.15     95.4±6.14µs        ? ?/sec
empty_systems/100_systems                                1.00     85.7±4.54µs        ? ?/sec      1.20    102.7±5.57µs        ? ?/sec
fake_commands/2000_commands                              1.06      7.3±0.04µs        ? ?/sec      1.00      6.9±0.04µs        ? ?/sec
fake_commands/4000_commands                              1.02     14.3±0.15µs        ? ?/sec      1.00     13.9±0.04µs        ? ?/sec
fake_commands/6000_commands                              1.03     21.7±0.11µs        ? ?/sec      1.00     21.0±0.06µs        ? ?/sec
fake_commands/8000_commands                              1.05     29.1±0.15µs        ? ?/sec      1.00     27.8±0.07µs        ? ?/sec
fragmented_iter/base                                     1.00   458.8±19.03ns        ? ?/sec      1.12   514.1±48.36ns        ? ?/sec
fragmented_iter/foreach                                  1.00   241.9±28.67ns        ? ?/sec      1.09   262.6±29.33ns        ? ?/sec
get_component/base                                       1.00  1088.4±79.34µs        ? ?/sec      1.05  1137.5±25.23µs        ? ?/sec
get_component/system                                     1.00   791.5±78.27µs        ? ?/sec      1.10   872.3±81.69µs        ? ?/sec
get_or_spawn/batched                                     1.00   408.2±20.63µs        ? ?/sec      1.04   426.3±47.21µs        ? ?/sec
get_or_spawn/individual                                  1.00   931.3±81.29µs        ? ?/sec      1.02   952.7±86.53µs        ? ?/sec
heavy_compute/base                                       1.02    367.1±5.29µs        ? ?/sec      1.00    359.5±3.46µs        ? ?/sec
insert_commands/insert                                   1.00   791.9±34.36µs        ? ?/sec      1.05   828.5±64.94µs        ? ?/sec
insert_commands/insert_batch                             1.00   403.2±48.73µs        ? ?/sec      1.05   424.4±42.30µs        ? ?/sec
no_archetypes/system_count/0                             1.00  1610.0±326.88ns        ? ?/sec     1.74      2.8±0.12µs        ? ?/sec
no_archetypes/system_count/100                           1.00    101.7±3.54µs        ? ?/sec      1.12    114.4±3.24µs        ? ?/sec
no_archetypes/system_count/20                            1.00     26.0±2.92µs        ? ?/sec      1.10     28.7±1.00µs        ? ?/sec
no_archetypes/system_count/40                            1.00     46.0±2.26µs        ? ?/sec      1.05     48.1±1.31µs        ? ?/sec
no_archetypes/system_count/60                            1.00     61.7±3.28µs        ? ?/sec      1.17     71.9±1.31µs        ? ?/sec
no_archetypes/system_count/80                            1.00     68.1±3.27µs        ? ?/sec      1.37     93.2±2.29µs        ? ?/sec
query_get/50000_entities_sparse                          1.00  1099.2±143.05µs        ? ?/sec     1.02  1119.7±69.13µs        ? ?/sec
query_get/50000_entities_table                           1.03   626.9±59.29µs        ? ?/sec      1.00   607.5±14.31µs        ? ?/sec
query_get_component/50000_entities_sparse                1.00  1198.5±111.82µs        ? ?/sec     1.10  1322.4±54.56µs        ? ?/sec
query_get_component/50000_entities_table                 1.00  1203.7±54.86µs        ? ?/sec      1.02  1223.6±38.66µs        ? ?/sec
run_criteria/yes_using_query/001_systems                 1.18      5.1±0.36µs        ? ?/sec      1.00      4.3±0.44µs        ? ?/sec
run_criteria/yes_using_query/006_systems                 1.14     12.0±0.53µs        ? ?/sec      1.00     10.4±0.63µs        ? ?/sec
run_criteria/yes_using_query/011_systems                 1.16     18.4±0.91µs        ? ?/sec      1.00     15.8±0.88µs        ? ?/sec
run_criteria/yes_using_query/016_systems                 1.09     23.9±0.62µs        ? ?/sec      1.00     21.9±0.97µs        ? ?/sec
run_criteria/yes_using_query/021_systems                 1.11     30.6±0.71µs        ? ?/sec      1.00     27.5±1.16µs        ? ?/sec
run_criteria/yes_using_query/026_systems                 1.07     35.9±1.38µs        ? ?/sec      1.00     33.5±1.08µs        ? ?/sec
run_criteria/yes_using_query/031_systems                 1.08     41.6±1.08µs        ? ?/sec      1.00     38.5±1.33µs        ? ?/sec
run_criteria/yes_using_query/036_systems                 1.05     46.6±1.52µs        ? ?/sec      1.00     44.4±1.11µs        ? ?/sec
run_criteria/yes_using_query/041_systems                 1.01     51.8±1.25µs        ? ?/sec      1.00     51.0±1.32µs        ? ?/sec
run_criteria/yes_using_query/046_systems                 1.05     57.6±1.28µs        ? ?/sec      1.00     55.0±1.26µs        ? ?/sec
run_criteria/yes_using_query/051_systems                 1.07     63.3±1.61µs        ? ?/sec      1.00     59.3±1.15µs        ? ?/sec
run_criteria/yes_using_query/056_systems                 1.08     70.3±2.75µs        ? ?/sec      1.00     65.2±1.45µs        ? ?/sec
run_criteria/yes_using_query/061_systems                 1.06     75.1±1.97µs        ? ?/sec      1.00     70.6±1.82µs        ? ?/sec
run_criteria/yes_using_query/066_systems                 1.06     81.0±2.21µs        ? ?/sec      1.00     76.5±2.06µs        ? ?/sec
run_criteria/yes_using_query/071_systems                 1.04     86.9±2.44µs        ? ?/sec      1.00     83.4±2.05µs        ? ?/sec
run_criteria/yes_using_query/076_systems                 1.10     94.1±2.17µs        ? ?/sec      1.00     85.8±3.43µs        ? ?/sec
run_criteria/yes_using_query/081_systems                 1.08    101.0±2.62µs        ? ?/sec      1.00     93.3±2.48µs        ? ?/sec
run_criteria/yes_using_query/086_systems                 1.06    106.2±2.54µs        ? ?/sec      1.00    100.1±3.21µs        ? ?/sec
run_criteria/yes_using_query/091_systems                 1.04    111.6±3.24µs        ? ?/sec      1.00    107.0±2.70µs        ? ?/sec
run_criteria/yes_using_query/096_systems                 1.07    119.4±3.33µs        ? ?/sec      1.00    111.1±4.45µs        ? ?/sec
run_criteria/yes_using_query/101_systems                 1.05    125.2±3.00µs        ? ?/sec      1.00    119.4±2.90µs        ? ?/sec
run_criteria/yes_using_resource/001_systems              1.17      5.1±0.36µs        ? ?/sec      1.00      4.3±0.13µs        ? ?/sec
run_criteria/yes_using_resource/006_systems              1.11     11.8±0.54µs        ? ?/sec      1.00     10.7±0.41µs        ? ?/sec
run_criteria/yes_using_resource/011_systems              1.09     17.3±0.56µs        ? ?/sec      1.00     15.8±0.57µs        ? ?/sec
run_criteria/yes_using_resource/016_systems              1.11     24.2±1.02µs        ? ?/sec      1.00     21.9±0.91µs        ? ?/sec
run_criteria/yes_using_resource/021_systems              1.11     30.1±0.75µs        ? ?/sec      1.00     27.2±0.77µs        ? ?/sec
run_criteria/yes_using_resource/026_systems              1.06     35.3±0.86µs        ? ?/sec      1.00     33.3±1.11µs        ? ?/sec
run_criteria/yes_using_resource/031_systems              1.11     41.2±1.21µs        ? ?/sec      1.00     37.2±1.35µs        ? ?/sec
run_criteria/yes_using_resource/036_systems              1.04     45.8±0.98µs        ? ?/sec      1.00     43.9±1.34µs        ? ?/sec
run_criteria/yes_using_resource/041_systems              1.07     52.6±1.19µs        ? ?/sec      1.00     49.3±1.12µs        ? ?/sec
run_criteria/yes_using_resource/046_systems              1.08     57.9±1.29µs        ? ?/sec      1.00     53.6±1.26µs        ? ?/sec
run_criteria/yes_using_resource/051_systems              1.09     64.4±1.65µs        ? ?/sec      1.00     59.0±1.49µs        ? ?/sec
run_criteria/yes_using_resource/056_systems              1.06     69.7±2.26µs        ? ?/sec      1.00     65.8±1.28µs        ? ?/sec
run_criteria/yes_using_resource/061_systems              1.05     75.3±1.98µs        ? ?/sec      1.00     71.3±1.41µs        ? ?/sec
run_criteria/yes_using_resource/066_systems              1.05     80.0±1.88µs        ? ?/sec      1.00     76.2±1.68µs        ? ?/sec
run_criteria/yes_using_resource/071_systems              1.05     86.5±2.88µs        ? ?/sec      1.00     82.1±1.96µs        ? ?/sec
run_criteria/yes_using_resource/076_systems              1.07     92.6±2.30µs        ? ?/sec      1.00     86.9±2.16µs        ? ?/sec
run_criteria/yes_using_resource/081_systems              1.05     99.3±2.33µs        ? ?/sec      1.00     95.1±2.20µs        ? ?/sec
run_criteria/yes_using_resource/086_systems              1.06    105.3±2.34µs        ? ?/sec      1.00     98.9±2.62µs        ? ?/sec
run_criteria/yes_using_resource/091_systems              1.07    112.1±2.76µs        ? ?/sec      1.00    105.0±2.81µs        ? ?/sec
run_criteria/yes_using_resource/096_systems              1.08    117.6±2.74µs        ? ?/sec      1.00    108.6±3.48µs        ? ?/sec
run_criteria/yes_using_resource/101_systems              1.04    123.0±2.90µs        ? ?/sec      1.00    117.7±2.90µs        ? ?/sec
run_criteria/yes_with_labels/001_systems                 1.07      4.8±0.29µs        ? ?/sec      1.00      4.5±0.32µs        ? ?/sec
run_criteria/yes_with_labels/006_systems                 1.00     10.8±0.33µs        ? ?/sec      1.00     10.8±0.68µs        ? ?/sec
run_criteria/yes_with_labels/011_systems                 1.00     16.1±0.62µs        ? ?/sec      1.00     16.1±0.75µs        ? ?/sec
run_criteria/yes_with_labels/016_systems                 1.00     21.5±0.59µs        ? ?/sec      1.03     22.1±0.96µs        ? ?/sec
run_criteria/yes_with_labels/021_systems                 1.00     26.5±0.79µs        ? ?/sec      1.03     27.2±1.04µs        ? ?/sec
run_criteria/yes_with_labels/026_systems                 1.00     31.2±0.77µs        ? ?/sec      1.05     32.6±1.30µs        ? ?/sec
run_criteria/yes_with_labels/031_systems                 1.00     35.2±0.88µs        ? ?/sec      1.06     37.2±1.53µs        ? ?/sec
run_criteria/yes_with_labels/036_systems                 1.00     40.0±1.32µs        ? ?/sec      1.07     43.0±1.06µs        ? ?/sec
run_criteria/yes_with_labels/041_systems                 1.00     45.4±1.16µs        ? ?/sec      1.09     49.4±1.06µs        ? ?/sec
run_criteria/yes_with_labels/046_systems                 1.00     48.2±1.12µs        ? ?/sec      1.11     53.6±1.56µs        ? ?/sec
run_criteria/yes_with_labels/051_systems                 1.00     54.2±1.13µs        ? ?/sec      1.12     60.6±1.47µs        ? ?/sec
run_criteria/yes_with_labels/056_systems                 1.00     57.1±1.43µs        ? ?/sec      1.13     64.5±1.48µs        ? ?/sec
run_criteria/yes_with_labels/061_systems                 1.00     62.5±1.31µs        ? ?/sec      1.12     70.1±1.68µs        ? ?/sec
run_criteria/yes_with_labels/066_systems                 1.00     66.8±1.50µs        ? ?/sec      1.15     77.0±1.55µs        ? ?/sec
run_criteria/yes_with_labels/071_systems                 1.00     72.2±2.67µs        ? ?/sec      1.13     81.6±1.72µs        ? ?/sec
run_criteria/yes_with_labels/076_systems                 1.00     76.2±2.12µs        ? ?/sec      1.15     87.4±2.57µs        ? ?/sec
run_criteria/yes_with_labels/081_systems                 1.00     81.3±1.98µs        ? ?/sec      1.15     93.1±2.55µs        ? ?/sec
run_criteria/yes_with_labels/086_systems                 1.00     85.4±2.58µs        ? ?/sec      1.14     97.2±2.38µs        ? ?/sec
run_criteria/yes_with_labels/091_systems                 1.00     88.4±2.51µs        ? ?/sec      1.18    104.6±3.59µs        ? ?/sec
run_criteria/yes_with_labels/096_systems                 1.00     94.0±3.65µs        ? ?/sec      1.17    110.4±2.79µs        ? ?/sec
run_criteria/yes_with_labels/101_systems                 1.00     98.6±2.37µs        ? ?/sec      1.20    118.2±2.81µs        ? ?/sec
simple_insert/base                                       1.00  616.8±107.65µs        ? ?/sec      1.10  676.1±116.08µs        ? ?/sec
simple_insert/unbatched                                  1.00  1367.2±80.74µs        ? ?/sec      1.07  1463.7±58.43µs        ? ?/sec
simple_iter/base                                         1.00     13.7±0.37µs        ? ?/sec      1.00     13.7±0.28µs        ? ?/sec
simple_iter/foreach                                      1.00     10.9±0.10µs        ? ?/sec      1.00     11.0±0.13µs        ? ?/sec
simple_iter/sparse                                       1.04     54.4±0.85µs        ? ?/sec      1.00     52.3±0.92µs        ? ?/sec
simple_iter/sparse_foreach                               1.00     43.8±2.69µs        ? ?/sec      1.10     48.2±0.49µs        ? ?/sec
simple_iter/system                                       1.00     13.6±0.12µs        ? ?/sec      1.01     13.8±0.15µs        ? ?/sec
sized_commands_0_bytes/2000_commands                     1.00      4.5±0.04µs        ? ?/sec      1.12      5.0±0.05µs        ? ?/sec
sized_commands_0_bytes/4000_commands                     1.00      9.0±0.03µs        ? ?/sec      1.13     10.2±0.04µs        ? ?/sec
sized_commands_0_bytes/6000_commands                     1.00     13.6±0.11µs        ? ?/sec      1.12     15.2±0.07µs        ? ?/sec
sized_commands_0_bytes/8000_commands                     1.00     18.2±0.22µs        ? ?/sec      1.12     20.3±0.11µs        ? ?/sec
sized_commands_12_bytes/2000_commands                    1.02      7.3±0.03µs        ? ?/sec      1.00      7.1±0.03µs        ? ?/sec
sized_commands_12_bytes/4000_commands                    1.00     14.5±0.08µs        ? ?/sec      1.00     14.5±0.18µs        ? ?/sec
sized_commands_12_bytes/6000_commands                    1.00     21.7±0.09µs        ? ?/sec      1.00     21.7±0.08µs        ? ?/sec
sized_commands_12_bytes/8000_commands                    1.00     29.0±0.25µs        ? ?/sec      1.00     29.0±0.14µs        ? ?/sec
sized_commands_512_bytes/2000_commands                   1.18    164.4±5.20µs        ? ?/sec      1.00    139.4±4.47µs        ? ?/sec
sized_commands_512_bytes/4000_commands                   1.18   335.7±22.85µs        ? ?/sec      1.00   283.9±20.57µs        ? ?/sec
sized_commands_512_bytes/6000_commands                   1.17   515.2±60.79µs        ? ?/sec      1.00   440.7±61.91µs        ? ?/sec
sized_commands_512_bytes/8000_commands                   1.18   682.4±73.22µs        ? ?/sec      1.00   580.5±66.60µs        ? ?/sec
sparse_fragmented_iter/base                              1.08     12.5±0.76ns        ? ?/sec      1.00     11.6±0.20ns        ? ?/sec
sparse_fragmented_iter/foreach                           1.00      8.7±0.35ns        ? ?/sec      1.02      8.9±0.12ns        ? ?/sec
spawn_commands/2000_entities                             1.00   269.6±26.87µs        ? ?/sec      1.03   276.5±31.06µs        ? ?/sec
spawn_commands/4000_entities                             1.00   535.3±46.75µs        ? ?/sec      1.04   558.3±41.82µs        ? ?/sec
spawn_commands/6000_entities                             1.00   782.7±70.84µs        ? ?/sec      1.05   819.8±92.08µs        ? ?/sec
spawn_commands/8000_entities                             1.00  1020.1±109.07µs        ? ?/sec     1.05  1072.7±107.70µs        ? ?/sec
world_entity/50000_entities                              1.00    426.0±2.68µs        ? ?/sec      1.00    424.2±0.98µs        ? ?/sec
world_get/50000_entities_sparse                          1.00   560.1±28.52µs        ? ?/sec      1.08   607.2±13.87µs        ? ?/sec
world_get/50000_entities_table                           1.00    883.3±5.88µs        ? ?/sec      1.09   962.5±12.36µs        ? ?/sec
world_query_for_each/50000_entities_sparse               1.00     83.3±2.52µs        ? ?/sec      1.17     97.1±3.49µs        ? ?/sec
world_query_for_each/50000_entities_table                1.01     27.4±0.40µs        ? ?/sec      1.00     27.2±0.50µs        ? ?/sec
world_query_get/50000_entities_sparse                    1.00   388.2±13.99µs        ? ?/sec      1.09   421.7±17.98µs        ? ?/sec
world_query_get/50000_entities_table                     1.00   278.4±12.11µs        ? ?/sec      1.03    287.1±5.80µs        ? ?/sec
world_query_iter/50000_entities_sparse                   1.00     87.7±2.42µs        ? ?/sec      1.17    102.1±6.38µs        ? ?/sec
world_query_iter/50000_entities_table                    1.01     27.8±1.17µs        ? ?/sec      1.00     27.4±1.50µs        ? ?/sec

@james7132 james7132 added S-Blocked This cannot move forward until something else changes and removed S-Needs-Benchmarking This set of changes needs performance benchmarking to double-check that they help labels Jun 1, 2022
@Weibye Weibye added the S-Adopt-Me The original PR author has no intent to complete this work. Pick me up! label Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Performance A change motivated by improving speed, memory usage or compile times S-Adopt-Me The original PR author has no intent to complete this work. Pick me up! S-Blocked This cannot move forward until something else changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants