Skip to content

perf(table): index schemas by ID - #1967

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

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

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Summary

  • Added schema ID indexes to metadata and MetadataBuilder.
  • Keeps indexes current when schemas are added or removed.
  • Uses copy-on-write for builder clones and built metadata.
  • Added regression tests and benchmarks for lookup behavior, stale slices, cloning, and concurrent reads.

Benchmark

Command: go test ./table -run ^ -bench "Benchmark(CommonMetadataSchemaByID|MetadataBuilderGetSchemaByID)" -benchtime=50ms -count=1

  • 8,192 schemas, builder last: about 9 ns/op indexed vs 7.4 us/op linear.
  • 8,192 schemas, builder miss: about 150 ns/op indexed vs 7.8 us/op linear.
  • 8,192 schemas, metadata last: about 200 ns/op indexed vs 7.7 us/op linear.
  • Metadata lookups still return defensive schema copies.

Tests

  • go test ./table -count=1
  • go test -race ./table -run "SchemaIndex|SchemaByID|MetadataBuilderCloneCoversAllFields" -count=1
  • go vet ./table
  • golangci-lint run --timeout=10m

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