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

update to latest zig-lsp-codegen with new LSP Message type/parser #1937

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Techatrix
Copy link
Member

This includes a new parser for the LSP json messages. Its up to 20% faster and uses half as much memory.
Binary size of ZLS goes up by about 1-3% but that is a trade off I am willing to take.

[nix-shell:~/repos/zig-lsp-codegen/zig-out/bin]$ poop ./bench-old-debug ./bench-new-debug
Benchmark 1 (3 runs): ./bench-old-debug
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          17.9s  ±  113ms    17.9s  … 18.1s           0 ( 0%)        0%
  peak_rss           30.9MB ± 14.4KB    30.9MB … 30.9MB          0 ( 0%)        0%
  cpu_cycles         62.7G  ±  220M     62.6G  … 63.0G           0 ( 0%)        0%
  instructions        122G  ± 6.10K      122G  …  122G           0 ( 0%)        0%
  cache_references   77.6M  ± 9.07M     70.0M  … 87.7M           0 ( 0%)        0%
  cache_misses       3.99M  ±  830K     3.49M  … 4.95M           0 ( 0%)        0%
  branch_misses      92.0M  ±  164K     91.8M  … 92.2M           0 ( 0%)        0%
Benchmark 2 (3 runs): ./bench-new-debug
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          15.4s  ±  314ms    15.0s  … 15.6s           0 ( 0%)        ⚡- 14.3% ±  3.0%
  peak_rss           15.9MB ± 2.36KB    15.9MB … 15.9MB          0 ( 0%)        ⚡- 48.4% ±  0.1%
  cpu_cycles         55.0G  ±  795M     54.1G  … 55.6G           0 ( 0%)        ⚡- 12.4% ±  2.1%
  instructions        105G  ± 8.31K      105G  …  105G           0 ( 0%)        ⚡- 13.9% ±  0.0%
  cache_references   97.8M  ± 9.71M     86.6M  …  104M           0 ( 0%)          + 26.1% ± 27.4%
  cache_misses       4.50M  ±  582K     3.84M  … 4.92M           0 ( 0%)          + 12.8% ± 40.7%
  branch_misses      75.6M  ±  849K     74.6M  … 76.1M           0 ( 0%)        ⚡- 17.8% ±  1.5%

[nix-shell:~/repos/zig-lsp-codegen/zig-out/bin]$ poop -d 20000 ./bench-old-safe ./bench-new-safe
Benchmark 1 (6 runs): ./bench-old-safe
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          3.62s  ± 26.3ms    3.59s  … 3.65s           0 ( 0%)        0%
  peak_rss           29.9MB ± 62.8KB    29.8MB … 30.0MB          0 ( 0%)        0%
  cpu_cycles         10.4G  ± 49.6M     10.4G  … 10.5G           0 ( 0%)        0%
  instructions       24.0G  ± 18.3M     24.0G  … 24.0G           0 ( 0%)        0%
  cache_references   16.0M  ±  398K     15.6M  … 16.6M           0 ( 0%)        0%
  cache_misses       1.89M  ± 82.5K     1.77M  … 2.02M           0 ( 0%)        0%
  branch_misses       116M  ± 92.9K      116M  …  116M           0 ( 0%)        0%
Benchmark 2 (8 runs): ./bench-new-safe
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          2.81s  ± 21.7ms    2.79s  … 2.84s           0 ( 0%)        ⚡- 22.3% ±  0.8%
  peak_rss           14.6MB ± 13.7KB    14.6MB … 14.6MB          3 (38%)        ⚡- 51.1% ±  0.2%
  cpu_cycles         9.27G  ± 55.4M     9.20G  … 9.35G           0 ( 0%)        ⚡- 11.0% ±  0.6%
  instructions       21.7G  ±  133      21.7G  … 21.7G           0 ( 0%)        ⚡-  9.5% ±  0.1%
  cache_references   8.15M  ±  406K     7.57M  … 8.82M           0 ( 0%)        ⚡- 49.1% ±  3.0%
  cache_misses       1.18M  ± 23.9K     1.14M  … 1.23M           0 ( 0%)        ⚡- 37.4% ±  3.5%
  branch_misses       108M  ±  351K      107M  …  108M           1 (13%)        ⚡-  7.3% ±  0.3%

[nix-shell:~/repos/zig-lsp-codegen/zig-out/bin]$ poop -d 20000 ./bench-old-fast ./bench-new-fast
Benchmark 1 (6 runs): ./bench-old-fast
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          3.37s  ± 19.0ms    3.35s  … 3.39s           0 ( 0%)        0%
  peak_rss           28.2MB ± 3.34KB    28.2MB … 28.2MB          0 ( 0%)        0%
  cpu_cycles         9.67G  ± 53.2M     9.61G  … 9.75G           0 ( 0%)        0%
  instructions       20.1G  ± 1.30K     20.1G  … 20.1G           0 ( 0%)        0%
  cache_references   10.1M  ±  447K     9.63M  … 10.9M           0 ( 0%)        0%
  cache_misses       1.86M  ±  608K     1.56M  … 3.10M           0 ( 0%)        0%
  branch_misses       133M  ±  415K      133M  …  134M           0 ( 0%)        0%
Benchmark 2 (8 runs): ./bench-new-fast
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          2.66s  ± 12.5ms    2.65s  … 2.68s           0 ( 0%)        ⚡- 21.0% ±  0.5%
  peak_rss           14.1MB ± 3.10KB    14.1MB … 14.1MB          0 ( 0%)        ⚡- 50.1% ±  0.0%
  cpu_cycles         8.77G  ± 42.6M     8.72G  … 8.85G           0 ( 0%)        ⚡-  9.3% ±  0.6%
  instructions       18.8G  ± 95.6      18.8G  … 18.8G           0 ( 0%)        ⚡-  6.5% ±  0.0%
  cache_references   5.97M  ±  117K     5.79M  … 6.13M           2 (25%)        ⚡- 41.0% ±  3.5%
  cache_misses       1.06M  ± 45.9K      986K  … 1.13M           0 ( 0%)        ⚡- 43.1% ± 24.9%
  branch_misses       124M  ± 54.1K      124M  …  124M           0 ( 0%)        ⚡-  7.0% ±  0.2%

[nix-shell:~/repos/zig-lsp-codegen/zig-out/bin]$ poop -d 20000 ./bench-old-small ./bench-new-small
Benchmark 1 (5 runs): ./bench-old-small
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          4.41s  ± 35.8ms    4.37s  … 4.46s           0 ( 0%)        0%
  peak_rss           28.0MB ± 3.43KB    28.0MB … 28.0MB          0 ( 0%)        0%
  cpu_cycles         13.5G  ± 59.0M     13.4G  … 13.6G           0 ( 0%)        0%
  instructions       31.9G  ± 1.01K     31.9G  … 31.9G           0 ( 0%)        0%
  cache_references   8.61M  ±  531K     8.03M  … 9.26M           0 ( 0%)        0%
  cache_misses       1.45M  ± 54.2K     1.39M  … 1.51M           0 ( 0%)        0%
  branch_misses       109M  ±  135K      109M  …  110M           0 ( 0%)        0%
Benchmark 2 (5 runs): ./bench-new-small
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          4.45s  ± 8.87ms    4.44s  … 4.46s           0 ( 0%)          +  1.0% ±  0.9%
  peak_rss           14.0MB ± 17.0KB    13.9MB … 14.0MB          0 ( 0%)        ⚡- 50.1% ±  0.1%
  cpu_cycles         15.3G  ± 45.3M     15.3G  … 15.4G           0 ( 0%)        💩+ 13.8% ±  0.6%
  instructions       43.5G  ± 1.61K     43.5G  … 43.5G           0 ( 0%)        💩+ 36.4% ±  0.0%
  cache_references   6.33M  ±  472K     5.62M  … 6.94M           0 ( 0%)        ⚡- 26.5% ±  8.5%
  cache_misses       1.01M  ± 47.9K      949K  … 1.07M           0 ( 0%)        ⚡- 30.5% ±  5.2%
  branch_misses      90.5M  ± 89.7K     90.4M  … 90.6M           0 ( 0%)        ⚡- 17.3% ±  0.2%

I benchmarked it with messages that got collected from ZLS while I was writing the benchmarking code.

This removes the workaround for `CodeActionKind`. If this issue is still
present, go to your favorite neovim dev and whine about it!

I don't care :)
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.

None yet

1 participant