Skip to content

perf: reuse allocations where possible for refactor/remove-bytes - #50

Open
Vonr wants to merge 5 commits into
CrabCraftDev:refactor/remove-bytesfrom
Vonr:perf/bytes-removal-refactor
Open

perf: reuse allocations where possible for refactor/remove-bytes#50
Vonr wants to merge 5 commits into
CrabCraftDev:refactor/remove-bytesfrom
Vonr:perf/bytes-removal-refactor

Conversation

@Vonr

@Vonr Vonr commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

vs refactor/remove-bytes:

Gungraun

gungraun::read_group::read complex_player:(read_file("tests/data/complex_player.dat"))
  ======= CALLGRIND ====================================================================
  Instructions:                      156945|158441               (-0.94420%) [-1.00953x]
  L1 Hits:                           215760|218863               (-1.41778%) [-1.01438x]
  LL Hits:                              426|427                  (-0.23419%) [-1.00235x]
  RAM Hits:                              85|85                   (No change)
  Total read+write:                  216271|219375               (-1.41493%) [-1.01435x]
  Estimated Cycles:                  220865|223973               (-1.38767%) [-1.01407x]
  ======= DHAT =========================================================================
  Total bytes:                        23658|23658                (No change)
  Total blocks:                         317|317                  (No change)
  At t-gmax bytes:                        0|0                    (No change)
  At t-gmax blocks:                       0|0                    (No change)
  At t-end bytes:                         0|0                    (No change)
  At t-end blocks:                        0|0                    (No change)
  Reads bytes:                        20845|20845                (No change)
  Writes bytes:                       19906|19906                (No change)
gungraun::read_group::read chunk:(read_file("tests/data/chunk.nbt"))
  ======= CALLGRIND ====================================================================
  Instructions:                      374038|366697               (+2.00193%) [+1.02002x]
  L1 Hits:                           512745|495402               (+3.50079%) [+1.03501x]
  LL Hits:                             2020|2025                 (-0.24691%) [-1.00248x]
  RAM Hits:                             463|466                  (-0.64378%) [-1.00648x]
  Total read+write:                  515228|497893               (+3.48167%) [+1.03482x]
  Estimated Cycles:                  539050|521837               (+3.29854%) [+1.03299x]
  ======= DHAT =========================================================================
  Total bytes:                        62716|62716                (No change)
  Total blocks:                         334|334                  (No change)
  At t-gmax bytes:                    62044|62044                (No change)
  At t-gmax blocks:                     332|332                  (No change)
  At t-end bytes:                         0|0                    (No change)
  At t-end blocks:                        0|0                    (No change)
  Reads bytes:                        12653|12653                (No change)
  Writes bytes:                       53924|53924                (No change)
gungraun::write_group::write complex_player:(read_file_to_nbt("tests/data/complex_player.dat")...
  ======= CALLGRIND ====================================================================
  Instructions:                      118093|355072               (-66.7411%) [-3.00672x]
  L1 Hits:                           171433|501785               (-65.8354%) [-2.92700x]
  LL Hits:                              355|1034                 (-65.6673%) [-2.91268x]
  RAM Hits:                              52|128                  (-59.3750%) [-2.46154x]
  Total read+write:                  171840|502947               (-65.8334%) [-2.92683x]
  Estimated Cycles:                  175028|511435               (-65.7771%) [-2.92202x]
  ======= DHAT =========================================================================
  Total bytes:                         3380|40613                (-91.6775%) [-12.0157x]
  Total blocks:                           1|946                  (-99.8943%) [-946.000x]
  At t-gmax bytes:                        0|0                    (No change)
  At t-gmax blocks:                       0|0                    (No change)
  At t-end bytes:                         0|0                    (No change)
  At t-end blocks:                        0|0                    (No change)
  Reads bytes:                            0|31864                (-100.000%) [---inf---]
  Writes bytes:                        3936|33722                (-88.3281%) [-8.56758x]
gungraun::write_group::write chunk:(read_file_to_nbt("tests/data/chunk.nbt"))
  ======= CALLGRIND ====================================================================
  Instructions:                      315736|1111765              (-71.6005%) [-3.52119x]
  L1 Hits:                           452053|1693890              (-73.3127%) [-3.74710x]
  LL Hits:                             3748|5901                 (-36.4853%) [-1.57444x]
  RAM Hits:                              56|1472                 (-96.1957%) [-26.2857x]
  Total read+write:                  455857|1701263              (-73.2048%) [-3.73201x]
  Estimated Cycles:                  472753|1774915              (-73.3648%) [-3.75442x]
  ======= DHAT =========================================================================
  Total bytes:                        44331|645941               (-93.1370%) [-14.5709x]
  Total blocks:                           1|1160                 (-99.9138%) [-1160.00x]
  At t-gmax bytes:                    44331|132563               (-66.5585%) [-2.99030x]
  At t-gmax blocks:                       1|2                    (-50.0000%) [-2.00000x]
  At t-end bytes:                         0|0                    (No change)
  At t-end blocks:                        0|0                    (No change)
  Reads bytes:                            0|485284               (-100.000%) [---inf---]
  Writes bytes:                       45499|528255               (-91.3869%) [-11.6103x]

Criterion

read/complex_player     time:   [10.538 µs 10.676 µs 10.793 µs]
                      thrpt:  [298.65 MiB/s 301.93 MiB/s 305.87 MiB/s]
               change:
                      time:   [-3.3676% -0.5746% +2.4782%] (p = 0.71 > 0.05)
                      thrpt:  [-2.4183% +0.5779% +3.4850%]
                      No change in performance detected.

read/chunk              time:   [33.164 µs 33.667 µs 34.099 µs]
                      thrpt:  [1.2108 GiB/s 1.2263 GiB/s 1.2449 GiB/s]
               change:
                      time:   [-7.9041% -4.1813% -0.4430%] (p = 0.03 < 0.05)
                      thrpt:  [+0.4450% +4.3638% +8.5824%]
                      Change within noise threshold.

   Running benches/write.rs (target/release/deps/write-15fb80df67147bb8)
write/complex_player    time:   [2.5407 µs 2.5644 µs 2.5854 µs]
                      thrpt:  [1.2175 GiB/s 1.2275 GiB/s 1.2390 GiB/s]
               change:
                      time:   [-83.944% -83.708% -83.469%] (p = 0.00 < 0.05)
                      thrpt:  [+504.92% +513.79% +522.83%]
                      Performance has improved.
Found 18 outliers among 100 measurements (18.00%)
18 (18.00%) low mild

write/chunk             time:   [10.866 µs 10.945 µs 11.025 µs]
                      thrpt:  [3.7447 GiB/s 3.7721 GiB/s 3.7997 GiB/s]
               change:
                      time:   [-80.070% -79.321% -78.612%] (p = 0.00 < 0.05)
                      thrpt:  [+367.55% +383.58% +401.77%]
                      Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
8 (8.00%) low mild

@Vonr Vonr changed the title perf: reuse allocations where possible perf: reuse allocations where possible for refactor/remove-bytes Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant