Closed 7sharp9 closed 6 years ago
Thanks Dave! Would you mind adding a basic unit test or two for this function as well?
@jack-pappas Yep, Ill add a few tests. Incidentally I was using this to try and improve on the map performance of some HM type inference with row polymorphism. Except it seems to be slower apart from high iteration counts vs map. Did you ever look into PersistantHashMap?
PersistentHashMap as in the Scala or Clojure 'vector' type? I did look at it at one point but never got around to actually implementing it for ExtCore.
If you have an example / benchmark of some code where HashMap
is slower than F# Map
and you can post it somewhere, I'm happy to take a look. HashMap
isn't guaranteed to be faster, but empirically I have found it to be faster in most cases I've used it.
@jack-pappas Im implementing various HM type inference algorithms with extension like row and variant polymorphism, possibly rank n types as well. I found the 100,000 iterations was the time when map was outperformed by hashmap. To be honest I was using a string as a type var identifier where an int and rank would be more efficient. Even not got to the point where Im overly worried about performance yet, Im just very mindful of the generic comparison overhead on map, especially with a string as I was using, I was surprised hashmap was slower for lower iterations.
Pretty much the same as the Map.union function