Parallel Processing Improvements in Julia Jet Reconstruction
Google Summer of Code 2026 final work product
Contributor: Harshit Nagpal
Organization/project: CERN-HSF · JuliaHEP · JetReconstruction.jl
Mentors: Graeme Stewart (DESY) and Mateusz Fila (CERN)
Original project: HSF project description
Summary
This project set out to investigate the multithreaded performance of Julia’s jet reconstruction. Serial Julia processing was already strong — for AntiKt it processed about 28% more events/s than FastJet — so the natural question was whether that advantage held up under event-level parallelism. It didn’t: as thread count increased, throughput scaled poorly, falling well short of the FastJet reference. I first built a reproducible Julia/FastJet thread-scaling benchmark workflow, then added scheduler and garbage-collection controls and progressively more targeted profiling. The measurements showed that the N2Tiled physics kernel and event scheduler retained nearly linear latent scaling; the dominant high-thread bottleneck was allocation-driven, stop-the-world garbage collection.
These results motivated an optimization focused on eliminating repeated allocations from the reconstruction workflow. The resulting optimization is an opt-in reusable workspace for complete N2Tiled reconstruction. It preserves the full ClusterSequence and existing owning API while allowing high-throughput applications to reuse jets, clustering history, tiled state, nearest-neighbour arrays, and output buffers.
Headline result: warm allocation fell from approximately 416 kB/event to 400–640 B/event (over 99.8% lower). An experimental campaign using the full-semantics workspace reached 351k events/s on 64 physical cores, corresponding to 59.0× speedup and 92.2% parallel efficiency. The production-facing implementation is in PR #252.
These results were presented at JuliaCon 2026
How the project progressed
| Period | Phase | Work and outcome |
|---|---|---|
| Early June | Build the first multithread benchmark | Benchmark PR #16 added thread scans, JSON/CSV aggregation, and throughput/speedup/efficiency plots. JetReconstruction PR #244 added timing-statistics support and kept plotting optional. |
| Mid June | Automate complete campaigns and add the C++ reference | Benchmark PR #18 added the full campaign driver; PR #19 completed the OpenMP FastJet workflow, shared merge/plot path, and documentation. |
| Late June–early July | Investigate the scaling failure | Benchmark PR #22 added GC controls and Julia scheduler support. I compared static, dynamic, greedy, and chunked_atomic scheduling with GC on/off. chunked_atomic avoided the severe high-thread collapse seen with greedy scheduling, but scheduler overhead was not the root cause. |
| July | Measure and prove the bottleneck | Whole-program profiles were narrowed into allocation, Julia accounting, and Linux perf campaigns; the reusable profiler was later packaged in benchmark PR #23. At 64 threads, GC occupied 81.6% of wall time, while the derived non-GC path retained 93.5% efficiency. Scheduling used only about 0.4 core-µs/event. |
| Late July–August | Optimize the demonstrated cause | JetReconstruction PR #252 reused full N2Tiled result and scratch storage through explicit per-worker workspaces, reducing warm allocation to hundreds of bytes per event and restoring near-ideal scaling. PR #256 extended the model to N2Plain. |
An important methodological correction was replacing early 1,500-event high-thread measurements with long timed regions. The short runs were useful signals, but they overstated sustainable throughput and were not used for the final root-cause conclusion.
Key results
| Stage | Result at 64 threads | Interpretation |
|---|---|---|
| Initial Julia N2Tiled | approximately 35.6k events/s and 10.7% efficiency; FastJet was 6.38x faster | Julia started ahead at one thread but lost most of its scaling as concurrency increased. |
| Root-cause campaign | 129.6 kB allocated/event, 81.6% GC wall share, but 93.5% derived non-GC efficiency | The physics/event path had enough parallelism; allocation-driven GC pauses removed useful CPU capacity. |
| Optimized workspace prototype | 351,066 events/s, 59.0x speedup, 92.2% efficiency, and about 400 B/event | Reusing the full result/history object graph removed the GC trigger and restored near-ideal scaling. |
| FastJet reference | 226,998 events/s and 92.6% efficiency | In the optimized campaign Julia was 1.55x faster while retaining complete clustering semantics. |
Before and after
Before - good serial performance, poor parallel scaling

The initial matched comparison used AntiKt N2Tiled, R=0.4, normal GC, FastJet OpenMP dynamic scheduling, and Julia’s default dynamic Threads.@threads. Julia was 1.35x faster at one thread, but reached only 10.7% efficiency at 64 threads.
After - full-semantics workspace with near-ideal scaling

With chunked_atomic dispatch and one reusable full-semantics workspace per worker, Julia reached 351k events/s at 64 threads versus 227k for FastJet. Allocation fell to about 400 B/event and parallel efficiency rose to 92.2%.
Code contributions and upstream status
Status at the GSoC final submission on 23 August 2026:
| Contribution | Status |
|---|---|
| Benchmark PR #16 — parallel benchmark harness | Merged |
| JetReconstruction PR #244 — benchmark statistics and optional plotting extension | Merged |
| Benchmark PR #18 — complete benchmark campaign driver | Merged |
| Benchmark PR #19 — FastJet comparison workflow and documentation | Merged |
| Benchmark PR #22 — GC controls and Julia scheduler support | Open, under review |
| Benchmark PR #23 — targeted profiling runner | Open, under review |
| JetReconstruction PR #252 — reusable full-semantics N2Tiled workspace | Open, final review; CI, docs, formatting, and compatibility checks pass |
| JetReconstruction PR #256 — reusable N2Plain workspace | Open, under review |
PR #252 is additive: ordinary reconstruction still returns independently owned results. The optimized route uses one mutable workspace per persistent worker and exposes a callback-scoped borrowed ClusterSequence; values that must outlive workspace reuse are copied by the caller. The final focused N2Tiled tests passed 152/152, and the latest pushed head passed the upstream CI, documentation, formatting, citation, and downgrade-compatibility workflows.
Current state and remaining work
At final submission, the benchmark infrastructure was already usable upstream, the bottleneck was understood, and the main optimization PRs were public and reviewable. The remaining work was deliberately narrow:
- complete review and merge of PRs #252 and #256;
- adapt the workspace patches if required after the larger type-generalization PR #247 lands;
Lessons
The main lesson was that allocation work can look small in an active-cycle profile yet cause a much larger stop-the-world and idle-capacity penalty. Separating GC wall time from active CPU cycles, validating the denominator of every plot, and using a causal allocation A/B test were essential. Scheduler tuning improved robustness, but eliminating the allocation trigger produced the real scaling improvement.
Acknowledgements and AI-use disclosure
I thank Graeme Stewart and Mateusz Fila for technical guidance and code review, and DESY for access to the EPYC benchmark machine. AI assistance was used for parts of analysis support, test/documentation drafting, and routine code-review preparation; I reviewed the outputs and take responsibility for the submitted code and results.