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

Refactor: Split use synonyms into separate maps for glob and item imports #5914

Merged
merged 3 commits into from
Apr 24, 2024

Conversation

jjcnn
Copy link
Contributor

@jjcnn jjcnn commented Apr 24, 2024

Description

Fixes #5911 .

So far all imported items in a module have been collected in single map, with a flag in each value indicating whether it was the result of a glob/star import or an item import (this distinction matters because item imports shadow glob imports).

This PR splits the map in two: One for glob imports and one for item imports. This simplifies name resolution, and eliminates the GlobImport flag.

When another module imports all reexported items the logic is now slightly more complex, but this will be resolved once the excessive cloning of namespaces, modules and typed declarations are eliminated.

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.

@jjcnn jjcnn requested review from tritao and a team April 24, 2024 12:30
Copy link

Benchmark for f82e10a

Click to view benchmark
Test Base PR %
code_action 6.2±0.20ms 6.3±0.22ms +1.61%
code_lens 338.7±9.43ns 320.2±22.57ns -5.46%
compile 6.8±0.21s 7.3±0.14s +7.35%
completion 6.0±0.43ms 6.9±0.44ms +15.00%
did_change_with_caching 6.8±0.13s 7.2±0.24s +5.88%
document_symbol 1044.6±22.18µs 1011.6±40.28µs -3.16%
format 79.3±1.15ms 79.4±1.60ms +0.13%
goto_definition 367.2±12.64µs 371.8±10.56µs +1.25%
highlight 9.7±0.33ms 9.7±0.34ms 0.00%
hover 610.8±13.90µs 695.3±20.57µs +13.83%
idents_at_position 124.2±1.13µs 122.7±1.50µs -1.21%
inlay_hints 679.6±27.60µs 671.5±38.33µs -1.19%
on_enter 501.8±12.91ns 492.2±15.94ns -1.91%
parent_decl_at_position 4.5±0.20ms 4.4±0.21ms -2.22%
prepare_rename 363.7±9.69µs 369.2±8.17µs +1.51%
rename 10.5±0.59ms 10.1±0.23ms -3.81%
semantic_tokens 1096.0±81.56µs 1092.8±32.74µs -0.29%
token_at_position 356.4±9.32µs 369.8±5.95µs +3.76%
tokens_at_position 4.4±0.16ms 4.4±0.26ms 0.00%
tokens_for_file 435.7±3.38µs 426.2±3.37µs -2.18%
traverse 52.2±2.08ms 54.4±3.16ms +4.21%

@IGI-111 IGI-111 merged commit 55140ba into master Apr 24, 2024
36 checks passed
@IGI-111 IGI-111 deleted the jjcnn/split-imports-into-glob-and-item branch April 24, 2024 15:04
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.

Separate glob imports from item imports
3 participants