← Back to context

Comment by malisper

14 hours ago

From the link

> Keys and values are fixed-size

so not quite what I'm looking for

You can store the strings separately and have the dictionary hold references to them.

Conceptually:

dictionary<i64, StringReference>

             |

             +----> "hello"

             +----> "a much longer string"

             +----> "x"

  • Isn’t this just re-inventing the index arena pattern, which nullifies much of the benefit over rust?

    > Goose code holds typed references where the equivalent Rust holds u32 indices into an arena — and it is where a good share of the benchmark wins come from.

    • In this particular case, you could make the values fixed length strings. Somewhere, performance and memory trades.