-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve decoding performance #81
Conversation
e24608f
to
68a5842
Compare
This yields a performance improvement over indexing into `source` over and over. `source` is asserted to be a string, `psz` is monotonically increasing, and `psz >= source.length` is a good indication that you've run out of characters. Originally proposed by @oscxc in cryptocoinjs#74. Co-authored-by: Rand <15077550@qq.com>
68a5842
to
261fb36
Compare
Rebased on top of @Nesopie's ESM changes. Let's get this in! |
You don’t feel like backporting this to bs58 version 4.x, do you @junderw? There are reasons we can’t upgrade to v6 and have to stay on 4.x. |
Give me a list of commands to backport and publish all these backports without updating the npm latest tag for everything, and I'll consider running those commands when I have free time. It would probably take me a few minutes to find everything, cherry-pick, push a branch for previous major version(s) push a tag to Github, publish to npm under a new non-latest tag etc. And then I would need to do the same for bs58 and bump the dependency etc. Probably about 15-20 minutes of work depending on how much I can concentrate without messing up. But if you give me a list of commands and I can check that they're sane, running them would be a few seconds. Assuming base-x and bs58 are sibling directories and these repos are |
For sure!
That's it. |
ok, should be published. |
Thank you! |
This yields a performance improvement over indexing into
source
over and over.source
is asserted to be a string,psz
is monotonically increasing, andpsz >= source.length
is a good indication that you've run out of characters.Originally proposed by @oscxc in #74.
Benchmarks
Before
After