This repository was archived by the owner on Jan 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
This repository was archived by the owner on Jan 26, 2026. It is now read-only.
Lazy Access to Field Dictionary #34
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Today when we deserialize an ImprintRecord it deserializes the entire field dictionary:
Lines 457 to 467 in 5d921ab
| let mut directory = Vec::new(); | |
| let (count, count_size) = varint::decode(bytes.clone())?; | |
| bytes.advance(count_size); | |
| bytes_read += count_size; | |
| for _ in 0..count { | |
| let (entry, entry_size) = DirectoryEntry::read(bytes.clone())?; | |
| bytes.advance(entry_size); | |
| bytes_read += entry_size; | |
| directory.push(entry); | |
| } |
Instead, we should just load the bytes into a struct and binary search on that when accessing fields, deserializing (and potentially caching the result) of a field id lookup only when necessary. This is in line with the ethos of Imprint, which optimizes for use cases that only read a few fields in a potentially large field dictionary.
We could consider making this configurable for the use case (eager/lazy deserialization of the field dictionary).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers