hashmap icon indicating copy to clipboard operation
hashmap copied to clipboard

Hashing objects other than vectors

Open theoldfather opened this issue 8 years ago • 1 comments

I imagine since you already have the ability to hash character vectors, it may not be too difficult to add the ability to hash serialized versions of other objects.

serialize(list(),connection=NULL)
 [1] 41 0a 32 0a 31 39 37 33 37 37 0a 31 33 31 38 34 30 0a 31 39 0a 30 0a

theoldfather avatar Oct 09 '16 16:10 theoldfather

The hashing of character vectors is not actually related to serialization, as I am just converting them to std::strings and using the default boost::hash to generate hash values.

Serializing objects efficiently would require performing this from the C++ side (most likely using R's internal serialization functions), and this would be a nontrivial feature to implement. While having the ability to hash objects other than simple vectors would be nice, it's not terribly high on my priority list as I made a conscious decision from the beginning to trade versatility for better performance. That being said, I'd be happy to review a well-written pull request.

nathan-russell avatar Oct 09 '16 23:10 nathan-russell