Skip to content

Commit b41a606

Browse files
committed
toplevel: Parallelize report_package signature analysis
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
1 parent 7147a40 commit b41a606

File tree

7 files changed

+666
-62
lines changed

7 files changed

+666
-62
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5353
<!-- links end -->
5454

5555
## [Unreleased]
56+
### Changed
57+
- **Parallelized `report_package`**: Method signature analysis in `report_package`
58+
is now parallelized using Julia's multithreading, providing significant
59+
speedup on multi-core systems.
60+
61+
> With `--threads=4,2`
62+
- Benchmark on `report_package(JET)`: 52.07s → 17.75s (~3x faster)
63+
- Benchmark on `report_package(CSV)`: 44.23s → 19.57s (~2x faster)
64+
5665
### Internal
5766
- Refactored the project file to use the [`[workspace]`](https://pkgdocs.julialang.org/v1/toml-files/#The-%5Bworkspace%5D-section) for the docs/test environment of JET.
5867
This allows running e.g. `julia --project=./test test/runtests.jl` or

0 commit comments

Comments
 (0)