Skip to content

Hash table refactor and performance improvements - #26

Merged
dsfulf merged 3 commits into
mainfrom
dwt/hash-table-perf
Mar 29, 2026
Merged

Hash table refactor and performance improvements#26
dsfulf merged 3 commits into
mainfrom
dwt/hash-table-perf

Conversation

@derrickturk

Copy link
Copy Markdown
Contributor

These commits refactor all hash-table related logic into shared construction and probing functions (with a callback interface) and replace forward chaining with a two-pass contiguous-array-based approach for hash join implementation. The net effect is that duplicate logic is removed and hash join performance is improved by up to ~2x for large tables in testing. This also means that the C-accelerated approach now beats the Python implementation for large-table joins; this wasn't always previously true.

Implementation was performed with Claude Opus 4.6; human prompting was extensive to drive the agent through the necessary profiling steps and away from various inadequate design choices. This is my first LLM-coauthored changeset for a public project, so while I have tried to review thoroughly, I may well have missed some things. All available tests remain passing, benchmarks meet or exceed previous performance, and valgrind doesn't find anything to complain about (at least in tafra code).

The refactor does rely on compiler inlining of callback functions for performance; the alternative would have been an ugly set of macros or a more obscure X-macro approach. Or C++, but that's a whole other std::can<worm>!

derrickturk and others added 3 commits March 25, 2026 01:22
This refactor was executed by the Claude Opus 4.6 LLM under human
direction. Tests pass, etc. but I wouldn't bet a kidney on it.

The goal is to remove duplicated and nearly-duplicated hash probing and
hash table construction logic. The chosen approach is to use callback
functions and rely on the optimizer to inline these appropriately.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This change was executed by the Claude Opus 4.6 LLM under human
direction. Tests pass, etc. but I wouldn't bet a spleen on it.

This commit replaces the forward-chaining approach used in the
accelerated hash join implementation with a two-pass approach for
building a contiguous array of right-side row indices sorted by
left-side row index.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dsfulf
dsfulf merged commit 03352c4 into main Mar 29, 2026
7 checks passed
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.

2 participants