Skip to content

Conversation

@aviatesk
Copy link
Owner

@aviatesk aviatesk commented Dec 1, 2025

Parallelize the analysis of method signatures in report_package using Threads.@spawn. Each analyze_method_signature! task gets its own independent AnalyzerState with local inf_cache and analysis_results, avoiding data races without complex cross-task cache sharing.

Design notes: https://publish.obsidian.md/jetls/work/JETLS/JET/JET+Make+%60report_package%60+parallelized

Key changes:

  • Add AtomicContainers module providing thread-safe container types (SWContainer, LWContainer, CASContainer) for concurrent access
  • Introduce CASDict for thread-safe analyzer cache (JET_ANALYZER_CACHE and OPT_ANALYZER_CACHE)
  • Add PackageAnalysisProgress struct for tracking parallel analysis progress with atomic counters
  • Parallelize analyze_from_definitions! in virtualprocess.jl

Benchmarks:

julia --startup-file-no --threads=4,2 -e 'using JET; report_package(JET; target_modules=(JET,), sourceinfo=:compact);'

Approach Time
sequential 52.07s
parallel 17.75s

julia --startup-file=no --threads=4,2 -e 'using JET; using Pkg; Pkg.activate(; temp=true); Pkg.add("CSV"); using CSV; report_package(CSV; target_modules=(CSV,), sourceinfo=:compact);'

Approach Time
sequential 44.23s
parallel 19.57s

@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 89.70588% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.92%. Comparing base (7147a40) to head (b2663fc).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/JETBase.jl 88.88% 5 Missing ⚠️
src/abstractinterpret/abstractanalyzer.jl 0.00% 1 Missing ⚠️
src/toplevel/virtualprocess.jl 95.45% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #785      +/-   ##
==========================================
+ Coverage   83.87%   83.92%   +0.04%     
==========================================
  Files          12       12              
  Lines        3033     3067      +34     
==========================================
+ Hits         2544     2574      +30     
- Misses        489      493       +4     

☔ 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.

Parallelize the analysis of method signatures in `report_package` using
`Threads.@spawn`. Each `analyze_method_signature!` task gets its own
independent `AnalyzerState` with local `inf_cache` and `analysis_results`,
avoiding data races without complex cross-task cache sharing.

Design notes: https://publish.obsidian.md/jetls/work/JETLS/JET/JET+Make+%60report_package%60+parallelized

Key changes:
- Add `AtomicContainers` module providing thread-safe container types
  (`SWContainer`, `LWContainer`, `CASContainer`) for concurrent access
- Introduce `CASDict` for thread-safe analyzer cache (`JET_ANALYZER_CACHE`
  and `OPT_ANALYZER_CACHE`)
- Add `PackageAnalysisProgress` struct for tracking parallel analysis
  progress with atomic counters
- Parallelize `analyze_from_definitions!` in virtualprocess.jl

Benchamrks:

> `julia --startup-file-no --threads=4,2 -e 'using JET; report_package(JET; target_modules=(JET,), sourceinfo=:compact);'`
| Approach   | Time   |
|------------|--------|
| sequential | 52.07s |
| parallel   | 17.75s |

> ``julia --startup-file=no --threads=4,2 -e 'using JET; using Pkg; Pkg.activate(; temp=true); Pkg.add("CSV"); using CSV; report_package(CSV; target_modules=(CSV,), sourceinfo=:compact);'``
| Approach   | Time   |
|------------|--------|
| sequential | 44.23s |
| parallel   | 19.57s |

Written by Claude
@aviatesk aviatesk merged commit 3df641a into master Dec 1, 2025
20 of 22 checks passed
@aviatesk aviatesk deleted the avi/multithreading branch December 1, 2025 11:23
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