Skip to content

Feat/multi-core-parallel-salt-finding#10

Closed
Ahmad8864 wants to merge 2 commits into
cpaczek:mainfrom
Ahmad8864:feat/multi-core-parallel-salt-finding
Closed

Feat/multi-core-parallel-salt-finding#10
Ahmad8864 wants to merge 2 commits into
cpaczek:mainfrom
Ahmad8864:feat/multi-core-parallel-salt-finding

Conversation

@Ahmad8864

Copy link
Copy Markdown
Contributor

Summary

  • Spawns up to 8 parallel brute-force workers (based on os.availableParallelism()) instead of one, significantly reducing salt search time on multi-core machines
  • First worker to find a salt wins; all others are aborted via AbortController
  • Progress aggregated across workers so rate/ETA stay accurate

Changes

File What changed
lib/finder.mjs New getWorkerCount() helper; findSalt() rewritten to spawn N workers, aggregate progress, and resolve on first success

Design decisions

  • Cap at 8 — diminishing returns beyond this, leaves cores free for the user
  • First-writer-wins — resolve immediately on first result, abort the rest
  • Per-worker error attribution — if all workers fail, stderr from each is surfaced in diagnostics

Test plan

  • Verify multiple workers spawn and salt is found correctly
  • Single-core fallback: getWorkerCount() returns 1, behaves like before
  • Timeout / error cases: cleanup fires, diagnostics are surfaced

@cpaczek

cpaczek commented Apr 2, 2026

Copy link
Copy Markdown
Owner

This is a crazy optimization for a task that takes no more than 30 seconds but I love it reviewing all the prs

@cpaczek

cpaczek commented Apr 2, 2026

Copy link
Copy Markdown
Owner

Closing in favor of #11 which includes multi-worker parallelism plus the early-exit optimization (massive perf win for rare targets). Your 8-core cap idea will be adopted into #11 — great call on leaving cores free for the user. Thank you @Ahmad8864 for the contribution!

@cpaczek cpaczek closed this Apr 2, 2026
cpaczek added a commit that referenced this pull request Apr 2, 2026
perf: multi-worker parallelism + early-exit (merges #11 with #8 and #10)
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.

2 participants