Skip to content

Eliminate remaining allocations in read operations (Map.Get/Has, Set.Has) - #91

Merged
marcelocantos merged 2 commits into
masterfrom
zero-alloc-read-operations
Mar 8, 2026
Merged

Eliminate remaining allocations in read operations (Map.Get/Has, Set.Has)#91
marcelocantos merged 2 commits into
masterfrom
zero-alloc-read-operations

Conversation

@marcelocantos

Copy link
Copy Markdown
Collaborator

Use reflect.Kind dispatch in resolveHashFunc, resolveSeededHashFunc, and
EqualFuncFor to catch derived types (e.g., type MyFloat float64) and
route them through direct hash/equality functions instead of boxing
through interface fallbacks. Add size-based integer fast-paths to
resolveSeededHashFunc. Add Map.Has and Set.Has benchmarks.

All read benchmarks now report 0 B/op, 0 allocs/op at 1k and 1M sizes.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

marcelocantos and others added 2 commits March 8, 2026 17:17
…Has)

Use reflect.Kind dispatch in resolveHashFunc, resolveSeededHashFunc, and
EqualFuncFor to catch derived types (e.g., type MyFloat float64) and
route them through direct hash/equality functions instead of boxing
through interface fallbacks. Add size-based integer fast-paths to
resolveSeededHashFunc. Add Map.Has and Set.Has benchmarks.

All read benchmarks now report 0 B/op, 0 allocs/op at 1k and 1M sizes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Split resolveHashFunc and resolveSeededHashFunc into kind-based and
size-based halves. Merge Complex64/Complex128 cases in resolveHashFunc.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@marcelocantos
marcelocantos merged commit bf5e07b into master Mar 8, 2026
4 checks passed
@marcelocantos
marcelocantos deleted the zero-alloc-read-operations branch March 8, 2026 07:17
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