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
-
The
fromMap
operation is currently defined as:Internally, this always creates a new
Map
structure, even if the originalMap
is already in canonical form (i.e., contains nomempty
values).It might be desirable to first check whether the provided
Map
is in canonical form, and if so, just perform a coercion, thus avoiding the creation of a newMap
structure: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