Skip to content

Conversation

DavyLandman
Copy link
Member

@DavyLandman DavyLandman commented Sep 24, 2025

Perf fix 1: getModule

The profiler showed that 10% of the time was spend in the loops that were going over the importedModules and for every one of them a get on the global heap.

I think the only reason this indirection existed was for reloading modules, but those graphs are always kept in sync, unless a module failed to load, and then they get deleted. So that event was propagated to the down stream modules.

Benchmarking showed that this decreased runtime of the checker by about 10%

Perf fix 2: getAllFunctions

The profiler also showed 8--10% of the time spend in calculating all functions reachable in a module. We now also have a cache around this calculation. This provided a 5% extra speed bump.

Benchmark:

A full typecheck of all stdlib (no parallel processing)

main (which includes type parameter caching #2417)

real    45m5.033s
user    50m21.411s
sys     0m10.656s

this branch

real    38m50.557s
user    41m48.807s
sys     0m8.843s

Copy link

codecov bot commented Sep 24, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 47%. Comparing base (3cb5ead) to head (1641294).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...g/rascalmpl/interpreter/env/ModuleEnvironment.java 79% 11 Missing and 2 partials ⚠️
...g/rascalmpl/interpreter/env/GlobalEnvironment.java 44% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##              main   #2441   +/-   ##
=======================================
  Coverage       47%     47%           
- Complexity    6613    6617    +4     
=======================================
  Files          783     783           
  Lines        64650   64676   +26     
  Branches      9673    9672    -1     
=======================================
+ Hits         30694   30715   +21     
- Misses       31562   31565    +3     
- Partials      2394    2396    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DavyLandman DavyLandman force-pushed the feat/reduce-module-environment-lookup branch from fd6aa30 to 87e5ede Compare September 24, 2025 16:07
@DavyLandman DavyLandman changed the title Reduce double map iteration of imported modules that need to be looked up in the heap everytime Add loopup caches in ModuleEnvironment to improve execution speed Sep 25, 2025
@DavyLandman DavyLandman marked this pull request as ready for review September 25, 2025 13:37
Copy link
Member

@jurgenvinju jurgenvinju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! I think we have one cache clear too many but I'm not sure. Please have a look.

@DavyLandman DavyLandman merged commit 8aaa455 into main Sep 29, 2025
7 checks passed
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.

2 participants