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 the module structure of the namespace module #6291

Draft
wants to merge 51 commits into
base: master
Choose a base branch
from

Conversation

jjcnn
Copy link
Contributor

@jjcnn jjcnn commented Jul 22, 2024

Description

Partial fix of #5498 .

The namespace module is used to represents the environment of bindings during compilation.

Until now we have treated external libraries as submodules of each module in the program being compiled. This leads to some illegal paths suddenly becoming legal. Additionally, the namespace module suffers from excessive cloning because external modules get cloned each time a new module is compiled. The treatment also means that path resolution must take into account whether a module is external or not.

This PR streamlines the module structure and the paths used in the environment. External modules are now represented separately from the current package, and path resolution is changed to take this separation into account. This allows us to eleminate a significant part of the excessive cloning, though there is still some cloning happening in the AST.

Current state:

  • The namespace module builds
  • Usage of the namespace module needs to be changed to use the new interface.

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.

Copy link

codspeed-hq bot commented Sep 5, 2024

CodSpeed Performance Report

Merging #6291 will improve performances by 13.35%

Comparing jjcnn/move-external-modules-to-root (57afd26) with master (bcd15c3)

Summary

⚡ 1 improvements
✅ 21 untouched benchmarks

Benchmarks breakdown

Benchmark master jjcnn/move-external-modules-to-root Change
did_change_with_caching 506.2 ms 446.6 ms +13.35%

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.

1 participant