Skip to content

Add hashcons weak-pointer/ephemeron benchmarks (bench_bdd, bench_lambda)#4

Open
udesou wants to merge 1 commit into
masterfrom
add-hashcons-benchmarks
Open

Add hashcons weak-pointer/ephemeron benchmarks (bench_bdd, bench_lambda)#4
udesou wants to merge 1 commit into
masterfrom
add-hashcons-benchmarks

Conversation

@udesou

@udesou udesou commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Adds backtracking's quick-and-dirty hash-consing benchmarks from ocaml-hashcons#19 under simple/hashcons/, filling a weak-pointer / ephemeron coverage gap in the suite (Frama-C etc. don't exercise this path).

hashcons.ml/.mli are vendored from backtracking/ocaml-hashcons (LGPL-2.1, J-C Filliâtre) as a local library, pinned so that only the runtime varies across compiler comparisons.

Benchmarks

bench args (config) character
bench_bdd -de-bruijn 800 memory-bound; the workload ocaml/ocaml#13580 (mark-delay, 5.5) targets
bench_bdd -pigeon 12 milder hash-consing stressor
bench_lambda 6 CPU-bound short micro (λ-calculus quicksort)

Notes / verification

  • -de-bruijn is the GC-pacing showcase. Verified locally at N=800: 5.4.1 → 5.5(d8bb46c) gives ~1.46× speedup (2.24s → 1.53s) and ~41% lower peak heap (46.8M → 27.7M words). Highly sensitive to space_overhead — a good candidate for the (s,o) sweeps. Runtime and peak RSS both scale with N (N=800 ≈ 2s / ~370 MB on 5.4).
  • -pigeon barely moves under #13580 (~7%) — kept for coverage, not as a PR demonstrator.
  • bench_lambda is CPU-bound (heap ~8 MB regardless of N) and has a combinatorial runtime cliff (N=6 ≈ 0.8s, N=7 ≈ 60s), so it stays a short micro.
  • Adaptation: bench_lambda reads its marshalled term from $QUICKSORT_TERM (absolute path) with a fallback to the upstream relative quicksort.term, because the running-ng run cwd is a temp dir. The config must point QUICKSORT_TERM at simple/hashcons/quicksort.term.

Default inputs chosen for ~2–3s on modern hardware; the running-ng config tunes N and the space_overhead sweep separately.

🤖 Generated with Claude Code

Add backtracking's quick-and-dirty hash-consing benchmarks from
ocaml-hashcons#19 to simple/hashcons/, filling a weak-pointer/ephemeron
coverage gap in the suite. hashcons.ml/.mli are vendored as a local
library so only the runtime varies across compiler comparisons.

- bench_bdd -de-bruijn N: hash-consed BDD for a de Bruijn tautology; the
  workload ocaml/ocaml#13580 (mark-delay, 5.5) targets. At N=800 it shows
  ~1.46x speedup and ~41% lower peak heap on 5.5 vs 5.4, and is highly
  space_overhead-sensitive.
- bench_bdd -pigeon N: pigeonhole tautology; milder hash-consing stressor.
- bench_lambda N: lambda-calculus quicksort over hash-consed terms;
  CPU-bound short micro. Reads its term file from $QUICKSORT_TERM (the run
  cwd is a temp dir) with a fallback to the upstream relative default.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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