Skip to content

Parallelize per-file analysis with rayon (issue #1474) - #1482

Merged
Gbangbolaoluwagbemiga merged 1 commit into
HyperSafeD:mainfrom
miraclesonly:feat/parallel-analyze-file-processing
Aug 27, 2026
Merged

Parallelize per-file analysis with rayon (issue #1474)#1482
Gbangbolaoluwagbemiga merged 1 commit into
HyperSafeD:mainfrom
miraclesonly:feat/parallel-analyze-file-processing

Conversation

@miraclesonly

@miraclesonly miraclesonly commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

#1474 — parallel processing
The issue's file pointer (tooling/sanctifier-cli/src/config.rs) doesn't exist anywhere in this
repo. The real "process multiple files concurrently" opportunity it describes is
analyze.rs's run_analysis(): a sequential for file_path in &rs_files loop running
RuleRegistry::run_all, analyze_ledger_size, and scan_storage_collisions per file — each
independent of the others. The file already had
#[allow(unused_imports)] use rayon::prelude::*; — rayon was already a declared dependency and
imported here, just never actually used.

Switched to rs_files.par_iter().filter_map(...), mirroring the Arc<Analyzer> + par_iter
pattern workspace.rs already uses for the identical shape of per-file work in this same crate.
registry/analyzer are now wrapped in Arc for read-only cross-thread sharing; each file's
(violations, size_warnings, collisions) are collected into a Vec first, then folded into the
existing totals sequentially afterward — avoids needing a Mutex around the shared counters,
and keeps the final output equivalent to the original sequential loop (aside from violation
ordering across files, which was never specified as significant).

Test plan

  • cargo check (tooling/sanctifier-cli): passes cleanly. Full workspace build, ~2m49s.
    Only warning is a pre-existing, unrelated dead-code warning in sanctifier-core
    (expr_contains_verifier), not touched by this change.

Closes #1474

Closes #1476

Closes #1475

Closes #1478

…feD#1474)

The issue's file pointer (tooling/sanctifier-cli/src/config.rs)
doesn't exist in this repo -- no config.rs anywhere under
sanctifier-cli/src. The actual "process multiple files... concurrently"
opportunity described in the issue is analyze.rs's run_analysis(): a
sequential `for file_path in &rs_files` loop running RuleRegistry::run_all,
analyze_ledger_size, and scan_storage_collisions per file, each
independent of the others. The file already had
`#[allow(unused_imports)] use rayon::prelude::*;` -- rayon was already
a declared dependency and imported here, just never used.

Switched to `rs_files.par_iter().filter_map(...)`, mirroring the
Arc<Analyzer> + par_iter pattern workspace.rs already uses for the
same shape of per-file work. Registry and analyzer are now wrapped in
Arc so they can be shared read-only across threads; each file's
(violations, size_warnings, collisions) results are collected into a
Vec first, then folded into the existing totals sequentially --
avoids needing a Mutex around the shared counters while keeping the
final output (all_violations order aside) equivalent to the original
sequential loop.

Closes HyperSafeD#1474
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@miraclesonly Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

@miraclesonly is attempting to deploy a commit to the gbangbolaoluwagbemiga's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Gbangbolaoluwagbemiga
Gbangbolaoluwagbemiga merged commit 899467f into HyperSafeD:main Aug 27, 2026
15 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants