Skip to content

n2plain-improved-scaling-on-multithread - #256

Open
HarshitNagpal29 wants to merge 2 commits into
JuliaHEP:mainfrom
HarshitNagpal29:n2plain-workspace
Open

n2plain-improved-scaling-on-multithread#256
HarshitNagpal29 wants to merge 2 commits into
JuliaHEP:mainfrom
HarshitNagpal29:n2plain-workspace

Conversation

@HarshitNagpal29

Copy link
Copy Markdown
Collaborator

Summary

This PR adds an opt-in reusable workspace for full N2Plain reconstruction, covering both hadron-collider and electron-positron algorithms.

The workspace reduces repeated per-event allocations by reusing reconstruction scratch arrays, jet storage, and clustering history while preserving the complete ClusterSequence semantics.

Changes

  • Add N2PlainWorkspace with support for:
    • PseudoJet storage for pp algorithms;
    • EEJet storage for e⁺e⁻ algorithms.
  • Add callback-scoped with_n2plain_reconstruction.
  • Reuse:
    • reconstructed jet storage;
    • complete clustering history;
    • pp nearest-neighbour and distance arrays;
    • e⁺e⁻ StructArray reconstruction storage.
  • Resize scratch arrays to the exact active event length.
  • Support caller-owned reusable output buffers through:
    inclusive_jets!(output, clusterseq)
    

Compatibility

This is an additive API change. Existing users continue receiving independently owned results. High-throughput applications can opt into reusable storage and copy only the values that must be retained.

@m-fila
m-fila self-requested a review August 16, 2026 22:18
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.

1 participant