You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use StringValue in dict key in ParametersSpec::collect
Summary:
Before this diff `kwargs` were collected into `Dict` which is `SmallMap<Hashed<Value>, Value>`.
Now `kwargs` are collected into `SmallMap<Hashed<StringValue>, Value>` and that `SmallMap` is "coerced" into a map with `Value` key.
When inserting keys we lookup previous keys (this should be partially addressed by [this PR in indexmap](indexmap-rs/indexmap#200)), and equality operation on `StringValue` is cheaper that equality on `Value` because there's no dynamic casts. We don't do real equality often (because hash collisions are rare), but having `StringValue` instead of `Value` may generate more efficient machine code.
Also this makes code a little more type-safe.
Reviewed By: ndmitchell
Differential Revision: D30921794
fbshipit-source-id: cf2b4fa72eeef150e6308d2fe2d7c16f59166586
0 commit comments