Implement EcoMap - #66
Conversation
|
Apparently |
|
Thanks for taking a stab at this. However, I'm afraid that the design goal I would have in mind for
What I would have in mind:
This would make I'm not sure whether it's possible to do this with hashbrown, which is one of the reasons why I didn't even attempt to add this before. As, to keep performance parity with hashbrown, we might have to basically maintain a fork. Another priority for me would be to have the code structured in a way that makes an |
|
My apologies, I had fundamentally misunderstood the layout constraints for Indeed, if we want to mimic We have two viable paths forward, either we drop If the single-pointer indirection requirement is non-negotiable then the former seems like our only option. Let me know which compromise aligns best with typst's philosophy and I can try to work on a solution. |
This implementation is probably missing minor things, but it should do very decently for a first draft. Let me know if there are things that should be replaced or bettered.
This implements EcoMap and tests for everything EcoMap. EcoMap can be inline, or spilled, where it's a simple CoW Rc (or Arc in case of sync flag added) wrapper of a hashmap (std's or hashbrown's in a no_std environment). This state is determined by a const generic N with a sensible default that the user may or may not provide.
We also integrate serde and rayon's parallel iterators in the case of sync.