Skip to content

perf(table): index snapshots by ID - #1806

Draft
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:perf/index-snapshots-by-id
Draft

perf(table): index snapshots by ID#1806
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:perf/index-snapshots-by-id

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Index snapshot IDs in table metadata and metadata builders.
  • Keep the index in sync when snapshots are added or removed.
  • Keep a safe fallback for package-level fixtures that replace the snapshot slice.
  • Add regression coverage and a lookup benchmark.

Performance

Snapshot lookup is roughly 150x faster in the 10,000-snapshot benchmark on an Apple M1 Pro.

Approach Result Relative speed
Indexed lookup 49 ns/op ~150x faster
Linear scan 7.8 us/op Baseline

This keeps the existing defensive copy behavior for returned snapshots.

Validation

  • go test ./table
  • go test -race ./table/...
  • go vet ./table
  • repository-wide tests for the remaining packages

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