Skip to content

perf(theta,tuple): hash a-not-b keys with a seeded folded multiply - #343

Open
davecromberge wants to merge 1 commit into
apache:mainfrom
davecromberge:perf-a-not-b-hasher
Open

davecromberge wants to merge 1 commit into
apache:mainfrom
davecromberge:perf-a-not-b-hasher

Conversation

@davecromberge

Copy link
Copy Markdown
Member

Replaces SipHash with a seeded folded multiply for the hash set that ThetaANotB and TupleANotB build from B when either input is unordered.

  • The keys are already uniformly distributed 64-bit hashes, so SipHash's cost buys nothing here. A per-call random seed keeps crafted sketches from forcing collisions; an unseeded multiply let a 65,536-entry B take 212 ms instead of 0.25 ms.
  • Ordered inputs use the existing merge path and are unchanged.

Speedup vs main from the characterization *_set_operations_speed_profile jobs (update-sketch inputs, ordered result; geometric mean over each band, best of 3 interleaved passes). Union, intersection and Jaccard in the same runs stay at 1.00×.

InU Theta A-not-B Tuple A-not-B
1–64 1.18× 1.16×
65–4,096 1.30× 1.33×
4,097–65,536 1.42× 1.81×
65,537–1,048,576 1.45× 1.83×

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <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