-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
LSP Optimization: Use rayon for parse_ast_to_typed_tokens
function
#5473
Conversation
Pull request was converted to draft
How come collecting typed tokens is taking |
This is how long it's taking to traverse and collect the tokens from the typed AST nodes. I'm going to look at using rayon par_iters for this section like we are doing in the Edit, i've managed to get it down to |
40bab43
to
67f3c6e
Compare
…5487) ## Description Use `rayon` par_iters in the `traverse::typed_tree` module. We are already doing this in `traverse::parsed_tree`, this just brings this over to the typed_tree module as well. Branched off #5473. <s>Will want to merge that first then will take this out of draft.</s> Collecting typed tokens on the benchmark project goes from `120.508917ms` → `14.853125ms` related to #5445
Description
Traversing the typed tokens from
sway-lib-std
now goes from3.957833ms
→1.372ms
. Collecting typed tokens on the benchmark project goes from139.6ms
→127.7ms
.I noticed that there are transient contentions when reading items from the
TokenMap
with this change. As such, I've implemented a new function on theTokenMap
calledtry_get_mut_with_retry
. This method tries to access the value up to 8 times if the lock is still held using the backoff and retry pattern.related to #5445
Checklist
Breaking*
orNew Feature
labels where relevant.