Skip to content

Conversation

Techatrix
Copy link
Member

based on top of #1057
fixes #536

I've benchmarked the total time required to generate semantic tokens for Sema.zig 20 times in a row.

Command Mean [s] Min [s] Max [s] Relative per request speedup 🚀
./bench-new-debug 8.273 ± 0.012 8.257 8.291 6.07 ± 0.08 413.65ms 16.7x
./bench-new-fast 1.364 ± 0.017 1.346 1.383 1.00 68.2ms 21.6x
./bench-new-safe 1.554 ± 0.012 1.537 1.569 1.14 ± 0.02 77.7ms 21.1x
./bench-new-small 1.964 ± 0.008 1.954 1.975 1.44 ± 0.02 98.2ms 17.8x
./bench-old-debug 138.830 ± 0.898 137.611 139.700 101.81 ± 1.43 6941.5ms
./bench-old-fast 29.566 ± 0.937 28.677 30.757 21.68 ± 0.74 1478.3ms
./bench-old-safe 32.906 ± 1.089 31.477 34.024 24.13 ± 0.85 1645.3ms
./bench-old-small 35.037 ± 0.845 34.158 35.969 25.69 ± 0.70 1751.8ms

The actual changes that improved performance are relatively small:

  • Calls to resolveTypeOfNode are now cached so they never have to be recomputed
  • scopes in DocumentScope now stores their parent and child scopes so that variable lookup becomes faster

@Techatrix Techatrix added the pr:fuzz Attach to a PR to start fuzzing / continually fuzz (please do this before merging!) label Mar 13, 2023
@leecannon leecannon merged commit c2d15bf into zigtools:master Mar 14, 2023
@Techatrix Techatrix deleted the optimize-analysis branch May 5, 2023 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:fuzz Attach to a PR to start fuzzing / continually fuzz (please do this before merging!)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Globals must go!
2 participants