Skip to content

perf: stream the mapping file straight into the index - #48

Merged
Ryder-C merged 2 commits into
devfrom
stream-mapping-parse
Aug 11, 2026
Merged

perf: stream the mapping file straight into the index#48
Ryder-C merged 2 commits into
devfrom
stream-mapping-parse

Conversation

@Ryder-C

@Ryder-C Ryder-C commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Replace full serde Value deserialization with custom visitor to save memory from useless json keys and values.

build_index used to deserialise the whole ~9 MB document into an
intermediate HashMap of all ~77k source entries (each with its own
inner map) before extracting the ~12k targets it actually needs --
about 33 MiB of transient allocations per refresh, which glibc then
retains as idle RSS. A streaming serde visitor now folds keys directly
into the four index maps and discards everything else as it goes.
Every index entry carried a Vec<String> that always held exactly one
"sN" key, which lookups then re-formatted or re-parsed. Seasons are now
parsed to u32 once at build time, dropping two heap allocations per
entry in each direction and simplifying both lookup sites.

Behavior note: a hypothetical scope like "s1e5" previously never
matched a season search (exact string compare) but now parses as
season 1; a survey of the live mappings file shows all 9,653 scopes
are plain "sN", so no practical change.
@Ryder-C
Ryder-C merged commit 704e233 into dev Aug 11, 2026
2 checks passed
@Ryder-C
Ryder-C deleted the stream-mapping-parse branch August 11, 2026 22:13
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