-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
feat(semantic): Add index mapping from span to reference id #270
feat(semantic): Add index mapping from span to reference id #270
Conversation
Benchmark is taking forever 😓 Maybe we'll fall back to a linear search instead |
@YangchenYe323 I found where your algorithm complexity blew up: You don't need to walk up the scope tree here. Pushing the unresolved references to the parent scope is enough. because the parent scope exit will pick up this routine again and carry the unresolved references upwards. Any I think we should move Note: For you need to actively check for |
I've made a new commit. Is it what you're suggesting? I experimented with it and found that it didn't give much boost in performace: The overall complexity would remain the same either way because the total number of references we're resolving is the same. The depth of the scope tree is not a dominating factor. |
For |
I wonder if it's due to hashing two u32 resulting too many hash collisions, FxHash is horrible in this regard ...
Shall we try with a Vec, sort it in the final build phase, and do binary search for lookup instead? |
2ed909d
to
1db7391
Compare
Unfortunately we can't. Currently But I found a workaround: use BTreeMap. The overhead seems negligible. |
c26ae88
to
4204002
Compare
4204002
to
cf6028c
Compare
cf6028c
to
c2dfaaf
Compare
The benchmark is finally back to normal. We can finally focus our energy on the HIR. |
As a temporary workaround, save mappings from
Span
toResolvedReferenceId
to enable searching for semantic information given anIdentifierReference