Commit b41a606
committed
toplevel: Parallelize
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 Claudereport_package signature analysis1 parent 7147a40 commit b41a606
File tree
7 files changed
+666
-62
lines changed- src
- AtomicContainers
- abstractinterpret
- analyzers
- toplevel
7 files changed
+666
-62
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
56 | 65 | | |
57 | 66 | | |
58 | 67 | | |
| |||
0 commit comments