xq
xq copied to clipboard
Rework on data structure
About objects, I guess that
- 20% of objects are not read (just deserialized from input, and discarded by the query),
- 75% of objects are not indexed (deserialized from input and serialized to output, but not examined),
- 4.9% of objects are not modified (indexed like
.keydoesn't have modifications like|=), and - only 0.1% of objects are actually modified.
If my guess was right, it'd probably make sense to use copy-on-write array-map (i.e. Vec<(Key, Value)>) (+ perhaps lazily create Trie<Key, EntryIndex>). Or maybe persistent version of Vec and Trie instead. Maybe Vec<Option<(Key, Value)>> to support fast deletion.