Remove all `Option<HashMap<K,V>>` in favor of `HashMap<K,V>` with an empty default
LegNeato opened this issue · 2 comments
LegNeato commented
It is more ergonomic to use an empty HashMap
and set a default when serializing and deserializing instead of an Option
so that code doesn't always have to check before using a field.
Because creating a default allocates, ideally we would put this behind a feature flag and let users decide if they prefer the ergonomics or (slight) perf increase.
srijs commented
IIRC creating an empty HashMap does not perform any heap allocations. Or are you referring to something else when you say ‚default‘?
LegNeato commented
Nope, I assumed it allocated but never checked. In that case I think this would strictly be a win.