Closed OpherV closed 8 years ago
Hello, @OpherV.
I'm not 100% sure, but as far as I remember node 4.X doesn't support destructruring (spread operator) like https://github.com/SkeLLLa/node-object-hash/blob/master/index.js#L20. I'll check it tomorrow.
@OpherV, hello again. I've checked the code and there are several issues that are not supported in node 4.X. There are spread operator, as I said before, and default function parameter values as well. So it will require some time to refactor all this things. So it may take couple of days to find some time to do that.
So you can wait some time or make a PR. As for alternative you can look to https://www.npmjs.com/package/object-hash library. It's author has fixed an issue with memory leak yesterday, that was one of the reason of writing this lib :).
Thanks so much for taking the time to have a look! I appreciate that.
Actually I used your library over object-hash because of that exact memory leak issue, and also because of the improved performance.
If you ever get the time to make it compatible with 4.X that would be lovely - in the meantime I used babel to transpile an es5 version of it. Ugly, I know - but it works :)
@OpherV as a quick fix I can eliminate default options from a function, then you can use other stuff if you can run node with flags like --harmony
. Also I think it will be also possible to run it on node 5.X after removing default function params.
@OpherV, for now added support of node 4.X.X with --harmony flag
. You can try 0.2.0 if you want. May be a bit later I modify rest code to support 4th version without any flags.
Brilliant! Thank you
Hi again, @OpherV. I've made some progress about supporting node version <=4.0.0. As a result I've done a complete rewrite of sorting mechanism. Good news - new hash lib is twice faster than current one. Bad news - due to rewriting of sorting mechanism new hashes will be different to previous ones :(.
As for benchmark for an array of 100000 random data objects: node-object-hash (current) = ~5.7s; Memory diff: (rss: 33 Mb, heap: 22 Mb) node-object-hash (v2) = ~2.9s; Memory diff: (rss: 1 Mb, heap: 40 Mb) object-hash (latest) = ~514s; Memory diff: (rss: 7 Mb, heap: 34 Mb)
I think I'll release it soon after writing some tests
That's awesome to hear! Looking forwards :) In my case I don't mind about the hashes themselves changing.
Release 1.0.0 published to npm. Now you can try it without any flags. Closing this for now. If you have any troubles, feel free to reopen.
This lib seems great! It's exactly what I need as well Is there a chance to have it compatible with node 4.3? What part of it is dependent on node 6.x?