Skip to content

Performance docs from three-machine sweeps; fix C's timer on macOS - #51

Merged
cjfields merged 3 commits into
mainfrom
docs/performance
Oct 16, 2026
Merged

cjfields merged 3 commits into
mainfrom
docs/performance

Conversation

@cjfields

Copy link
Copy Markdown
Member

Part of #31.

1. build_c.sh: C's timer on macOS (760e943)

  • Problem: C's profiler (system/profiler_timer.c) reads the clock on macOS with three Mach calls, about 1.3 µs per alignment inside the timed interval.
    • C looked about 6× slower on 150 bp reads, and 20–25% slower on 1 kb fast modes (e.g. m1k_5 edit score: 113.5 → 91.5 ms).
    • So earlier M2 Rust/C ratios were too optimistic, including the old README ARM table.
  • Fix: the macOS build now uses clock_gettime, as on Linux. The build fails rather than silently skipping the patch if the C source no longer matches.
  • Testing: alignments are unchanged (differential suites core and biwfa: 284/284 identical).
  • Cache stamp: cached C builds now carry a recipe number and are rebuilt when it changes, so older builds aren't reused. Every existing C build, Linux included, rebuilds once, in about a minute.

2. Performance docs (032646b, d1ed0f9)

  • README: the March tables (Broadwell, Apple M-series, one dataset) are replaced by a summary of bench/sweep.py runs at fc51088 on an Apple M2 Pro, an AMD EPYC 7713 and an Intel Xeon Gold 6150. Each machine ran 301 cases, and output is identical to C everywhere. The summary also lists the known gaps:
  • docs/performance.md: the method, builds, datasets and full tables (by group, per algorithm, peak memory, overall), plus notes and how to reproduce. It's pinned to fc51088 and C 3282f83.
  • bench/report.py: generates those tables from any set of sweep output directories.
  • The README project tree and .claude/PLAN.md are updated for the new files.

The underlying data and the Xeon profile are posted in #31.

🤖 Generated with Claude Code

cjfields and others added 3 commits October 16, 2026 14:39
C's profiler (system/profiler_timer.c) reads the clock on macOS with three
Mach calls (host_get_clock_service, clock_get_time, mach_port_deallocate),
about 1.3 us per alignment inside the timed interval. That made C look ~6x
slower on 150 bp reads and 20-25% slower on 1 kb fast modes, so M2 Rust/C
ratios were too optimistic. On macOS the build now uses clock_gettime, as
on Linux (macOS 10.12+); alignments are unchanged (differential core and
biwfa suites identical).

Cached C builds are now stamped with a recipe number and rebuilt when it
changes, so existing unpatched builds are not reused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README's tables were from the initial port (2026-03: Broadwell and
Apple M-series, one dataset). They are replaced by a summary of bench/sweep.py
runs at fc51088 on an Apple M2 Pro, an AMD EPYC 7713 and an Intel Xeon Gold
6150 (301 cases each, output identical to C everywhere), with known gaps.

docs/performance.md has the method, datasets and full tables, pinned to
fc51088 and C 3282f83. bench/report.py generates the tables from sweep
output directories.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cjfields

Copy link
Copy Markdown
Member Author

These are largely documentation or documentation-related changes, so merging.

@cjfields
cjfields merged commit 45f419e into main Oct 16, 2026
17 checks passed
@cjfields
cjfields deleted the docs/performance branch October 17, 2026 14:59
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