Repository navigation
perf(exec): polish scale/performance for rank(by="harmonic_closeness") #508
Description
Problem
rank(by="harmonic_closeness") is a shipped public analyst algorithm whose primary cost class is
BFS-heavy all-sources harmonic closeness. After M4's shared infrastructure (#337/#340/#341) and the first
compute-kernel batch (#342–#344), this algorithm still needs focused scale and
performance polish so large embedded workloads do not leave available CPU/memory
headroom unused—or so remaining serial costs are measured and dispositioned honestly.
Objective
Polish scale and performance for public rank(by="harmonic_closeness") (BFS-heavy all-sources harmonic closeness) while preserving deterministic ordering, fingerprints, cancellation, resource limits, and structured errors.
Debt / regime
- Debt type: development and test/proof
- Quality regime: A compute
- Family:
rank
Requirements
- Prefer feat(api): define a bounded embedded execution resource policy #337's instance-owned private
ComputePooland automatic crossover when
independent work units exist; keep a serial path for one thread and below a
measured crossover. Never use Rayon's process-global pool. - Consume CSR-native adjacency (perf(exec): consume persisted CSR without edge-scale hash-map expansion #340) and bounded Arrow sinks (perf(exec): shape analyst outputs directly into bounded Arrow batches #341); do not
introduce parallel-only graph copies or O(E) HashMap expansion on index hits. - Preserve deterministic public contracts: schemas, row order, ties, fingerprints,
cancellation, work/output limits, and structured errors at1/2/4/8/automatic
configurations where parallelism is introduced. - If parallelism is unsafe for numeric/order semantics, keep the algorithm serial and
instead polish representation, allocation, early-exit, and evidence—document the
disposition rather than changing bits. - Record test(performance): establish the M4 embedded baseline and entry gate #334-style before/after structural evidence (work units, threads/path, peak
RSS, fingerprint, hardware-specific timing). Timing is never a CI pass/fail gate. - Keep Rust authoritative; Python/Node remain thin bindings.
Acceptance Criteria
- Public
rank(by="harmonic_closeness")has an evidence-backed performance disposition
(parallel path with measured crossover or explicit serial polish with proof). - Deterministic fingerprints / schemas / ordering match the accepted one-thread
oracle at every supported thread configuration that executes. - Cancellation, work/output limits, and worker failure return structured outcomes
without partial public results. - CSR-native / Arrow-shaping structural gates hold for the changed path.
- Docs name the crossover or serial disposition; no universal scale claim or GPU claim.
- Exact-head CI for the changed surface is green.
BDD Completion Scenarios
Scenario: Independent work uses the private pool when safe
Given a workload above the measured crossover and a multi-thread policy
When harmonic_closeness executes
Then eligible independent work runs on the instance-owned compute pool
And public results match the one-thread oracle.
Scenario: Small work avoids universal parallel tax
Given a small fixture or one-thread policy
When the same invocation runs
Then the serial path is retained
And no pool setup becomes a universal latency tax.
Scenario: Unsafe parallelism is dispositioned, not forced
Given an algorithm whose numeric/order semantics forbid parallel reduction
When this issue closes
Then the serial contract is preserved
And allocation/representation/evidence polish is documented instead.
Non-Goals
- Approximate algorithms that change public exactness contracts.
- GPU / distributed / foreign-engine fallbacks.
- Changing public schemas or tie-breaking rules.
- Re-doing perf(exec): parallelize exact cosine KNN by canonical source #342–perf(exec): parallelize Node2Vec walk generation deterministically #344 cosine / PageRank / Node2Vec walk work.
Related Issues
- epic(performance): polish scale and performance for remaining M4 analyst algorithms #498 — parent tracker; this issue blocks it.
- epic(performance): close M4 embedded performance and scale #335 — M4 close tracker; this issue blocks it.
- feat(api): define a bounded embedded execution resource policy #337 / perf(exec): consume persisted CSR without edge-scale hash-map expansion #340 / perf(exec): shape analyst outputs directly into bounded Arrow batches #341 — shared infrastructure prerequisites.
- test(performance): establish the M4 embedded baseline and entry gate #334 / test(performance): reconcile final M4 exit evidence and scale claims #345 — evidence methodology.
Activity
coderabbitai commentedon Aug 10, 2026
🔗 Related PRs
#485 - test(performance): establish M4 embedded entry baseline (
#334) [merged]#492 - perf(exec): parallelize PageRank updates deterministically (
#343) [open]#493 - perf(exec): parallelize Node2Vec walk generation (
#344) [open]#494 - perf(exec): parallelize exact cosine KNN by source (
#342) [open]#496 - test(performance): reconcile M4 exit evidence and scale claims (
#345) [closed]📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
perf(exec): parallelize harmonic_closeness on ComputePool (#508)
perf(exec): parallelize harmonic_closeness on ComputePool (#508)
perf(exec): parallelize harmonic_closeness on ComputePool (#508) (#600)