Skip to content

perf: Use rustc-hash for the out-of-order buffer of the record serializer - #754

Merged
Kriskras99 merged 1 commit into
apache:mainfrom
janwaleed09:record_cache_hasher
Nov 29, 2026
Merged

Kriskras99 merged 1 commit into
apache:mainfrom
janwaleed09:record_cache_hasher

Conversation

@janwaleed09

@janwaleed09 janwaleed09 commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

As suggested in #753, the buffer for record fields that arrive out of order now uses FxHashMap from rustc-hash instead of a SipHash HashMap. The keys are field positions, so HashDoS isn't a concern here.

This doesn't depend on #752 or #753 and merges cleanly with both, in either order.

On my machine (macOS, aarch64), for records with 8 to 2048 fields, compared with main:

  • most fields out of order: 20–32 % faster
  • two fields swapped: 4–18 % faster
  • all fields in schema order: 4–21 % faster, because main calls remove on the empty buffer for every field

#753 skips that call while the buffer is empty. On top of it, records in schema order don't change, records with most fields out of order get 17–29 % faster and with two fields swapped up to 11 %.

The buffer is only used with insert and remove, so the output can't change. Comparing it with main for 1.2 million random records (aliases, defaults, shuffled fields) found no difference.

@Kriskras99
Kriskras99 merged commit 75d8f72 into apache:main Nov 29, 2026
18 checks passed
@Kriskras99

Copy link
Copy Markdown
Contributor

Thanks!

@martin-g martin-g added this to the 0.24.0 milestone Nov 30, 2026
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.

3 participants