Skip to content

Conversation

amesgen
Copy link
Member

@amesgen amesgen commented Jul 29, 2025

Not a priority for now, but opening a PR to have a reference

Relies on the fact that boosted points all lie on the same chain (which is not true across cooldowns, so this requires special care)

@amesgen amesgen added the Peras label Jul 29, 2025
@amesgen
Copy link
Member Author

amesgen commented Jul 29, 2025

  weightBoostOfFragment of length 0:    OK
    20.0 ns ± 2.0 ns,  31 B  allocated,   0 B  copied,  39 MB peak memory,       same as baseline
  weightBoostOfFragment of length 100:  OK
    4.46 μs ± 118 ns, 9.5 KB allocated,   0 B  copied,  39 MB peak memory, 56% less than baseline
  weightBoostOfFragment of length 200:  OK
    4.54 μs ± 184 ns, 9.6 KB allocated,   0 B  copied,  39 MB peak memory, 79% less than baseline
  weightBoostOfFragment of length 300:  OK
    4.32 μs ± 357 ns, 8.0 KB allocated,   0 B  copied,  39 MB peak memory, 88% less than baseline
  weightBoostOfFragment of length 400:  OK
    4.74 μs ± 473 ns, 8.9 KB allocated,   0 B  copied,  39 MB peak memory, 92% less than baseline
  weightBoostOfFragment of length 500:  OK
    4.19 μs ± 2.6 μs, 9.1 KB allocated,   0 B  copied,  39 MB peak memory, 95% less than baseline
  weightBoostOfFragment of length 600:  OK
    3.27 μs ± 502 ns, 8.3 KB allocated,   0 B  copied,  39 MB peak memory, 97% less than baseline
  weightBoostOfFragment of length 700:  OK
    4.03 μs ± 185 ns, 9.2 KB allocated,   0 B  copied,  39 MB peak memory, 97% less than baseline
  weightBoostOfFragment of length 800:  OK
    4.25 μs ± 377 ns, 9.4 KB allocated,   0 B  copied,  39 MB peak memory, 97% less than baseline
  weightBoostOfFragment of length 900:  OK
    4.02 μs ± 378 ns, 8.6 KB allocated,   0 B  copied,  39 MB peak memory, 97% less than baseline
  weightBoostOfFragment of length 1000: OK
    4.08 μs ± 403 ns, 9.5 KB allocated,   0 B  copied,  39 MB peak memory, 97% less than baseline
  weightBoostOfFragment of length 1100: OK
    3.97 μs ± 376 ns, 9.6 KB allocated,   0 B  copied,  39 MB peak memory, 97% less than baseline
  weightBoostOfFragment of length 1200: OK
    3.12 μs ± 291 ns, 8.0 KB allocated,   0 B  copied,  39 MB peak memory, 98% less than baseline
  weightBoostOfFragment of length 1300: OK
    2.95 μs ± 292 ns, 8.9 KB allocated,   0 B  copied,  39 MB peak memory, 98% less than baseline
  weightBoostOfFragment of length 1400: OK
    2.95 μs ± 255 ns, 9.1 KB allocated,   0 B  copied,  39 MB peak memory, 98% less than baseline
  weightBoostOfFragment of length 1500: OK
    2.89 μs ± 170 ns, 8.3 KB allocated,   0 B  copied,  39 MB peak memory, 98% less than baseline
  weightBoostOfFragment of length 1600: OK
    3.31 μs ± 284 ns, 9.2 KB allocated,   0 B  copied,  39 MB peak memory, 98% less than baseline
  weightBoostOfFragment of length 1700: OK
    3.24 μs ± 145 ns, 9.4 KB allocated,   0 B  copied,  40 MB peak memory, 98% less than baseline
  weightBoostOfFragment of length 1800: OK
    3.11 μs ± 304 ns, 8.6 KB allocated,   0 B  copied,  40 MB peak memory, 98% less than baseline
  weightBoostOfFragment of length 1900: OK
    3.37 μs ± 189 ns, 9.5 KB allocated,   0 B  copied,  40 MB peak memory, 98% less than baseline
  weightBoostOfFragment of length 2000: OK
    3.49 μs ± 338 ns, 9.7 KB allocated,   0 B  copied,  40 MB peak memory, 98% less than baseline
  weightBoostOfFragment of length 2100: OK
    2.74 μs ± 131 ns, 8.0 KB allocated,   0 B  copied,  40 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 2200: OK
    2.93 μs ±  86 ns, 8.9 KB allocated,   0 B  copied,  40 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 2300: OK
    3.09 μs ± 266 ns, 9.1 KB allocated,   0 B  copied,  40 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 2400: OK
    3.02 μs ± 223 ns, 8.3 KB allocated,   0 B  copied,  40 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 2500: OK
    3.28 μs ± 150 ns, 9.2 KB allocated,   0 B  copied,  40 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 2600: OK
    3.29 μs ± 200 ns, 9.4 KB allocated,   0 B  copied,  40 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 2700: OK
    3.13 μs ± 183 ns, 8.6 KB allocated,   0 B  copied,  40 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 2800: OK
    3.24 μs ± 239 ns, 9.5 KB allocated,   0 B  copied,  41 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 2900: OK
    3.28 μs ± 246 ns, 9.6 KB allocated,   0 B  copied,  41 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 3000: OK
    2.70 μs ± 197 ns, 8.0 KB allocated,   0 B  copied,  41 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 3100: OK
    2.97 μs ± 271 ns, 8.9 KB allocated,   0 B  copied,  41 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 3200: OK
    3.00 μs ± 204 ns, 9.1 KB allocated,   0 B  copied,  41 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 3300: OK
    2.91 μs ± 242 ns, 8.3 KB allocated,   0 B  copied,  41 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 3400: OK
    3.18 μs ± 179 ns, 9.2 KB allocated,   0 B  copied,  42 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 3500: OK
    3.16 μs ± 209 ns, 9.4 KB allocated,   0 B  copied,  42 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 3600: OK
    3.01 μs ± 165 ns, 8.6 KB allocated,   0 B  copied,  42 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 3700: OK
    3.21 μs ±  82 ns, 9.5 KB allocated,   0 B  copied,  42 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 3800: OK
    3.35 μs ± 262 ns, 9.6 KB allocated,   0 B  copied,  42 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 3900: OK
    2.75 μs ± 254 ns, 8.0 KB allocated,   0 B  copied,  42 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 4000: OK
    3.32 μs ± 307 ns, 8.9 KB allocated,   0 B  copied,  43 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 4100: OK
    3.63 μs ± 194 ns, 9.1 KB allocated,   0 B  copied,  43 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 4200: OK
    3.40 μs ± 606 ns, 8.3 KB allocated,   0 B  copied,  43 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 4300: OK
    4.17 μs ± 416 ns, 9.2 KB allocated,   0 B  copied,  43 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 4400: OK
    4.50 μs ± 418 ns, 9.4 KB allocated,   0 B  copied,  43 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 4500: OK
    4.35 μs ± 426 ns, 8.6 KB allocated,   0 B  copied,  43 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 4600: OK
    4.97 μs ± 343 ns, 9.5 KB allocated,   0 B  copied,  44 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 4700: OK
    4.08 μs ± 1.3 μs, 9.6 KB allocated,   0 B  copied,  44 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 4800: OK
    3.47 μs ± 210 ns, 8.0 KB allocated,   0 B  copied,  44 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 4900: OK
    3.96 μs ± 356 ns, 8.9 KB allocated,   0 B  copied,  44 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 5000: OK
    4.20 μs ± 722 ns, 9.1 KB allocated,   0 B  copied,  45 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 5100: OK
    3.38 μs ± 210 ns, 8.3 KB allocated,   0 B  copied,  45 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 5200: OK
    3.18 μs ± 381 ns, 9.2 KB allocated,   0 B  copied,  45 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 5300: OK
    3.13 μs ± 214 ns, 9.4 KB allocated,   0 B  copied,  45 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 5400: OK
    3.02 μs ± 181 ns, 8.6 KB allocated,   0 B  copied,  46 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 5500: OK
    3.23 μs ± 168 ns, 9.5 KB allocated,   0 B  copied,  46 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 5600: OK
    3.32 μs ± 266 ns, 9.6 KB allocated,   0 B  copied,  46 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 5700: OK
    2.67 μs ± 145 ns, 8.0 KB allocated,   0 B  copied,  46 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 5800: OK
    2.93 μs ± 237 ns, 8.9 KB allocated,   0 B  copied,  47 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 5900: OK
    3.53 μs ± 234 ns, 9.1 KB allocated,   0 B  copied,  47 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 6000: OK
    2.77 μs ± 322 ns, 8.3 KB allocated,   0 B  copied,  47 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 6100: OK
    3.03 μs ± 214 ns, 9.2 KB allocated,   0 B  copied,  47 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 6200: OK
    3.04 μs ± 241 ns, 9.4 KB allocated,   0 B  copied,  48 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 6300: OK
    3.02 μs ± 264 ns, 8.6 KB allocated,   0 B  copied,  48 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 6400: OK
    3.17 μs ± 256 ns, 9.5 KB allocated,   0 B  copied,  48 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 6500: OK
    3.33 μs ± 203 ns, 9.6 KB allocated,   0 B  copied,  49 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 6600: OK
    2.69 μs ± 195 ns, 8.0 KB allocated,   0 B  copied,  50 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 6700: OK
    1.99 μs ± 172 ns, 8.9 KB allocated,   0 B  copied,  50 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 6800: OK
    2.01 μs ± 189 ns, 9.1 KB allocated,   0 B  copied,  51 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 6900: OK
    2.01 μs ± 188 ns, 8.3 KB allocated,   0 B  copied,  51 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 7000: OK
    2.17 μs ± 208 ns, 9.2 KB allocated,   0 B  copied,  51 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 7100: OK
    2.13 μs ± 206 ns, 9.4 KB allocated,   0 B  copied,  52 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 7200: OK
    2.10 μs ± 168 ns, 8.6 KB allocated,   0 B  copied,  52 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 7300: OK
    2.28 μs ± 167 ns, 9.5 KB allocated,   0 B  copied,  52 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 7400: OK
    2.34 μs ± 182 ns, 9.6 KB allocated,   0 B  copied,  53 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 7500: OK
    1.90 μs ± 174 ns, 8.0 KB allocated,   0 B  copied,  53 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 7600: OK
    2.01 μs ± 297 ns, 8.9 KB allocated,   0 B  copied,  53 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 7700: OK
    2.31 μs ±  92 ns, 9.1 KB allocated,   0 B  copied,  54 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 7800: OK
    2.37 μs ± 125 ns, 8.3 KB allocated,   0 B  copied,  54 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 7900: OK
    2.62 μs ± 174 ns, 9.2 KB allocated,   0 B  copied,  54 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 8000: OK
    2.32 μs ± 232 ns, 9.4 KB allocated,   0 B  copied,  55 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 8100: OK
    2.14 μs ± 145 ns, 8.6 KB allocated,   0 B  copied,  55 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 8200: OK
    2.27 μs ± 125 ns, 9.5 KB allocated,   0 B  copied,  55 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 8300: OK
    2.34 μs ±  95 ns, 9.6 KB allocated,   0 B  copied,  56 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 8400: OK
    1.90 μs ± 135 ns, 8.0 KB allocated,   0 B  copied,  56 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 8500: OK
    2.17 μs ± 190 ns, 8.9 KB allocated,   0 B  copied,  57 MB peak memory, 99% less than baseline
  weightBoostOfFragment of length 8600: OK
    2.13 μs ± 175 ns, 9.1 KB allocated,   0 B  copied,  57 MB peak memory, 99% less than baseline

For the largest fragment, we have a reduction from 1.25 ms to 2.13 μs.

@amesgen amesgen force-pushed the amesgen/opt-weight-snapshot branch 4 times, most recently from c13b020 to 9544349 Compare July 30, 2025 09:08
@amesgen amesgen force-pushed the amesgen/opt-weight-snapshot branch from 9544349 to 4f232eb Compare August 8, 2025 08:13
@amesgen amesgen force-pushed the amesgen/opt-weight-snapshot branch from 4f232eb to 18c93d4 Compare August 13, 2025 16:53
@amesgen amesgen changed the title Optimize Peras weight calculation [WIP] Optimize Peras weight calculation Sep 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant