Notes: a compact id index #227

Closed
kayg wants to merge 0 commits from issue/44-index-2 into dev
Owner

Part of #44. Replaces #200, rebased onto dev after #224 and without mimalloc (#199, not merging).

The id index held every note's id and path twice, in two maps of owned strings: ~25 MB of heap at 100k notes, most of what was left at rest (heaptrack). Each note's id and path are now stored once in a slot; lookups by id and by folded path map a hash to slot numbers and check the slot on every hit (collisions keep a short list, newest first, matching a map's overwrite). A model test runs 5,000 random puts/renames/case changes/removes against two plain maps.

Heap at rest at 100k: about 8 MB less. Perf-VM numbers with the system-allocator work will follow on #44.

🤖 Generated with Claude Code

Part of #44. Replaces #200, rebased onto dev after #224 and without mimalloc (#199, not merging). The id index held every note's id and path twice, in two maps of owned strings: ~25 MB of heap at 100k notes, most of what was left at rest (heaptrack). Each note's id and path are now stored once in a slot; lookups by id and by folded path map a hash to slot numbers and check the slot on every hit (collisions keep a short list, newest first, matching a map's overwrite). A model test runs 5,000 random puts/renames/case changes/removes against two plain maps. Heap at rest at 100k: about 8 MB less. Perf-VM numbers with the system-allocator work will follow on #44. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Notes: a compact id index
Some checks failed
CI / rust (pull_request) Successful in 2m8s
CI / web (pull_request) Failing after 26s
6b10db7381
The id index held every note's id and path twice over, in two maps of
owned strings: about 25 MB of heap at 100,000 notes, most of what was
left at rest (#44). Each note's id and path are now stored once, in a
slot; the lookups by id and by folded path map a hash to slot numbers and
check the slot on every hit (a collision keeps a short list, newest
first, like a map's overwrite). A model test runs thousands of puts,
renames, case changes and removes against two plain maps.

Heap at rest at 100k notes: about 8 MB less.

Part of #44

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
Author
Owner

Merged into dev via train j (#391).

Merged into dev via train j (#391).
kayg closed this pull request 2026-10-15 02:22:47 +00:00
Some checks failed
CI / rust (pull_request) Successful in 2m8s
CI / web (pull_request) Failing after 26s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!227
No description provided.