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

change to use parking_lot::RwLock for better performance #6014

Merged
merged 3 commits into from
May 15, 2024

Conversation

JoshuaBatty
Copy link
Member

Description

Switching from std::sync::RwLock to parking_lot::RwLock is giving us a 10% further performance increase.

before: 13.459551958s
after: 12.125325542s

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@JoshuaBatty JoshuaBatty self-assigned this May 15, 2024
@JoshuaBatty JoshuaBatty added compiler General compiler. Should eventually become more specific as the issue is triaged performance Everything related to performance, speed wise or memory wise. labels May 15, 2024
@JoshuaBatty JoshuaBatty requested review from a team May 15, 2024 01:06
Copy link

Benchmark for 94c6962

Click to view benchmark
Test Base PR %
code_action 5.2±0.08ms 5.4±0.05ms +3.85%
code_lens 297.0±9.45ns 333.1±6.07ns +12.15%
compile 3.0±0.05s 3.0±0.03s 0.00%
completion 4.6±0.07ms 4.7±0.08ms +2.17%
did_change_with_caching 2.9±0.05s 2.9±0.03s 0.00%
document_symbol 943.6±11.91µs 980.7±23.20µs +3.93%
format 71.4±1.01ms 77.0±1.09ms +7.84%
goto_definition 372.8±5.51µs 365.6±5.41µs -1.93%
highlight 8.8±0.02ms 9.0±0.12ms +2.27%
hover 489.9±5.09µs 483.0±5.99µs -1.41%
idents_at_position 124.1±0.79µs 122.8±0.65µs -1.05%
inlay_hints 651.9±15.19µs 666.6±25.23µs +2.25%
on_enter 478.6±7.85ns 517.3±12.68ns +8.09%
parent_decl_at_position 3.6±0.02ms 3.7±0.02ms +2.78%
prepare_rename 371.6±4.24µs 368.4±11.49µs -0.86%
rename 9.3±0.11ms 9.6±0.03ms +3.23%
semantic_tokens 1053.9±22.55µs 1084.4±30.60µs +2.89%
token_at_position 365.3±2.38µs 357.7±1.95µs -2.08%
tokens_at_position 3.6±0.04ms 3.7±0.03ms +2.78%
tokens_for_file 437.7±2.92µs 434.8±2.38µs -0.66%
traverse 41.6±0.59ms 42.1±0.66ms +1.20%

@JoshuaBatty JoshuaBatty enabled auto-merge (squash) May 15, 2024 02:06
@kayagokalp kayagokalp requested a review from a team May 15, 2024 06:48
@JoshuaBatty JoshuaBatty merged commit 8d50370 into master May 15, 2024
35 checks passed
@JoshuaBatty JoshuaBatty deleted the josh/parking_lot branch May 15, 2024 07:50
Copy link

Benchmark for 5de14b0

Click to view benchmark
Test Base PR %
code_action 5.2±0.06ms 5.3±0.02ms +1.92%
code_lens 295.5±9.20ns 333.5±8.27ns +12.86%
compile 2.9±0.03s 2.9±0.04s 0.00%
completion 4.6±0.19ms 4.7±0.07ms +2.17%
did_change_with_caching 2.8±0.03s 2.8±0.05s 0.00%
document_symbol 945.4±41.23µs 983.4±41.76µs +4.02%
format 70.8±0.93ms 76.8±3.51ms +8.47%
goto_definition 368.5±5.38µs 360.6±5.70µs -2.14%
highlight 8.9±0.16ms 9.0±0.12ms +1.12%
hover 489.5±17.00µs 479.6±4.83µs -2.02%
idents_at_position 122.3±0.26µs 122.5±1.20µs +0.16%
inlay_hints 659.8±16.80µs 665.2±23.04µs +0.82%
on_enter 482.1±7.82ns 489.8±13.22ns +1.60%
parent_decl_at_position 3.6±0.04ms 3.7±0.07ms +2.78%
prepare_rename 370.5±12.25µs 365.0±15.06µs -1.48%
rename 9.4±0.07ms 9.6±0.13ms +2.13%
semantic_tokens 1019.6±13.60µs 1060.3±9.52µs +3.99%
token_at_position 370.7±3.20µs 356.4±2.43µs -3.86%
tokens_at_position 3.6±0.03ms 3.7±0.03ms +2.78%
tokens_for_file 430.9±2.49µs 434.5±7.81µs +0.84%
traverse 40.4±1.39ms 41.3±1.01ms +2.23%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler General compiler. Should eventually become more specific as the issue is triaged performance Everything related to performance, speed wise or memory wise.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants