Skip to content

perf: multi-worker parallelism + early-exit in brute-force#11

Closed
Co-Messi wants to merge 1 commit into
cpaczek:mainfrom
Co-Messi:perf/multi-worker-early-exit
Closed

perf: multi-worker parallelism + early-exit in brute-force#11
Co-Messi wants to merge 1 commit into
cpaczek:mainfrom
Co-Messi:perf/multi-worker-early-exit

Conversation

@Co-Messi

@Co-Messi Co-Messi commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Multi-worker parallelism: Spawns one Bun worker per CPU core instead of a single worker. First match wins, all others are killed. Gives ~Nx wall-clock speedup on multi-core machines.
  • Early-exit in hot loop: Inlined quickRoll() with per-attribute checks — mismatches skip remaining RNG calls immediately. For a legendary target (~1% rarity), 99% of iterations now bail after the first check.
  • Reduced IPC overhead: Progress reporting interval bumped from 25K to 100K iterations.
  • Progress display: Shows [N cores] during search and total attempts across all workers on completion.

Compatibility

  • os.availableParallelism is accessed as a runtime property check (not a named import) to stay compatible with Node >=18.0 as declared in package.json.

Test plan

  • Run any-buddy interactively and verify multi-core progress display ([N cores])
  • Verify search completes and correctly patches the binary
  • Test on Node 18.x to confirm no import errors
  • Compare search times vs main branch for a rare+ target

🤖 Generated with Claude Code

Spawn one worker per CPU core for ~Nx speedup on the salt search.
Inline attribute checks with early-exit so mismatches skip remaining
RNG calls (e.g. 99% of iterations skip after rarity check for legendary).
Bump progress interval from 25K to 100K to reduce IPC overhead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cpaczek added a commit that referenced this pull request Apr 2, 2026
perf: multi-worker parallelism + early-exit (merges #11 with #8 and #10)
@cpaczek cpaczek closed this in #12 Apr 2, 2026
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