r-lib / fastmap

Fast map implementation for R
https://r-lib.github.io/fastmap/
Other
133 stars 7 forks source link

Use a hash map library that has consistent ordering across platforms #10

Closed wch closed 1 year ago

wch commented 5 years ago

See https://github.com/r-lib/fastmap/issues/8#issuecomment-497942394. The idea is that the order from $keys() and $as_list() doesn't have to be sorted in any particular fashion; it just should be consistent across platforms so that users aren't surprised when behavior isn't reproducible when moving code from one platform to another.

rstub commented 4 years ago

One possibility would be boost::unordered_map. Brings in the hefty BH dependency, though. If you go for including a fast hash map implementation (like now tsl::hopscotch_map), it would be great if you could place it in inst/include. This would allow other packages to make use of it, too.

wch commented 4 years ago

Yeah, I don't want to bring in BH as a dependency. It's important for this package to be lightweight. Also, as far as I know, there's no guarantee that boost::unordered_map is consistent across platforms.

As for putting the headers in inst/, I don't want to do that for reasons explained here: https://github.com/r-lib/fastmap/pull/9#issuecomment-498730852