Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Consider iterating over the string in forward direction #12

Open
victor-homyakov opened this issue Oct 11, 2018 · 3 comments
Open

Consider iterating over the string in forward direction #12

victor-homyakov opened this issue Oct 11, 2018 · 3 comments

Comments

@victor-homyakov
Copy link

Differences include iterating over the string backwards (as that is faster in JavaScript)

This requires some proof, because for long strings backward iteration may break any data caching/prefetching, therefore access to string characters may be significantly slower.

https://jsperf.com/string-hash-speed forward direction is faster in Chrome

https://gist.github.com/victor-homyakov/bcb7d7911e4a388b1c810f8c3ce17bcf shows me that in Node 8.6.0 forward iteration is twice as fast.

@ghost
Copy link

ghost commented Oct 12, 2018

Yes, this is almost certainly correct now. JS has evolved tremendously since this library was put to paper (six years ago!), and I've been loathe to change it (since it's a breaking change and perhaps people rely on the hash values being consistent).

@dguo
Copy link

dguo commented Apr 7, 2020

@ironwallaby would it make sense to do so by releasing the change with a new major version?

@ghost
Copy link

ghost commented Apr 24, 2020

We won't be doing that from here, since this library is no longer maintained. Please fork and go ahead! (And, if you like, link us to the fork and we'll link to it from the README.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants