Potentially more efficient fromMap operation.
#188
jonathanknowles
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The
fromMapoperation is currently defined as:Internally, this always creates a new
Mapstructure, even if the originalMapis already in canonical form (i.e., contains nomemptyvalues).It might be desirable to first check whether the provided
Mapis in canonical form, and if so, just perform a coercion, thus avoiding the creation of a newMapstructure:However, one downside of this optimisation is that it penalises the general case, which would now require two traversals of the original map, whereas before only one traversal was required.
We might be able to get the best of both worlds by providing two operations, and allowing the caller to choose:
Beta Was this translation helpful? Give feedback.
All reactions