Skip to content

Add arena-backed hash map and docs#4

Merged
efvincent merged 2 commits into
mainfrom
hashmap-and-docs
Jul 13, 2026
Merged

Add arena-backed hash map and docs#4
efvincent merged 2 commits into
mainfrom
hashmap-and-docs

Conversation

@efvincent

Copy link
Copy Markdown
Owner

Summary

  • add a new core_hash module with hash traits for integer keys and Str8
  • add an arena-backed core_hash_map module using Robin Hood open addressing with cached per-slot hashes
  • support set-style usage via HashMap<K, void> and HashSet<K>
  • make Str8::match(...) and Str8::hash_fnv1a() const so hash traits can use them directly
  • add authored documentation for the hash map algorithms, core module relationships, and rendered Doxygen entry flow
  • configure Doxygen to use a dedicated Markdown main page

Review and Audit

  • no blocking review findings for the scoped phase
  • markdown docs were updated to reflect the implemented container design and follow-up roadmap
  • Doxygen comments were added for the HashMap/HashSet implementation surface

Validation

  • make
  • make docs

Scope Notes

  • this phase is function-complete for the planned map/set surface: init, reserve, growth/rehash, upsert, contains, pointer lookup, clear, and empty
  • erase, tombstones, iterators, heterogeneous lookup, and test coverage remain deferred follow-up items rather than unfinished work in this phase

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.

Comment on lines +440 to +443
u64 target_capacity = normalize_capacity(requested_capacity);
if (io_capacity >= target_capacity) {
return HashMapR<bool>::ok(false);
}
Comment on lines +499 to +503
u64 target_capacity = normalize_capacity(requested_capacity);

if (io_capacity >= target_capacity) {
return HashMapR<bool>::ok(false);
}
Comment on lines +445 to +454
u64 snapshot = arena.offset;

K* new_keys = arena.alloc_array<K>(target_capacity);
V* new_values = arena.alloc_array<V>(target_capacity);
u64* new_hashes = arena.alloc_array<u64>(target_capacity);
u8* new_ctrl = arena.alloc_array<u8>(target_capacity);

if (!new_keys || !new_ctrl || !new_values || !new_hashes) {
arena.offset = snapshot;
return HashMapR<bool>::err(HashMapE::OutOfMemory);
Comment on lines +505 to +514
u64 snapshot = arena.offset;

K* new_keys = arena.alloc_array<K>(target_capacity);
u64* new_hashes = arena.alloc_array<u64>(target_capacity);
u8* new_ctrl = arena.alloc_array<u8>(target_capacity);

if (!new_keys || !new_ctrl || !new_hashes) {
arena.offset = snapshot;
return HashMapR<bool>::err(HashMapE::OutOfMemory);
}
@efvincent efvincent merged commit a36140f into main Jul 13, 2026
1 check passed
@efvincent efvincent deleted the hashmap-and-docs branch July 13, 2026 17:56
@efvincent efvincent restored the hashmap-and-docs branch July 13, 2026 17:56
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