-
Notifications
You must be signed in to change notification settings - Fork 8
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
make parser 70x times faster? #13
Comments
Hi! So for the back-story, this module was forked from isbn2 as I attempted to better understand how it was working. It probably lost some perf optimizations on the way, but was more readable to me like this, and thus easier to maintain and keep open for future changes. That said, performance boost that don't hinder the readability/maintainability are very welcome! Could you submit a PR with your new approach, ideally without breaking changes, and with some comments on how that works? That big |
Sure thing, I can try to come up with a PR that won't break the API. Just one question for my understanding of API compatibility: Does the outcome of the parse operation have to be a plain JS object with all the fields? Or can it be a class object with getter properties instead? |
Returning a class object with getters would be a breaking change I think: for instance, passing that object to |
Hi, I am working some time now on a really fast ISBN parser/formatter in Java. And for this Java library (https://github.com/creativecouple/isbn-validation-java/) I recently found a way to speed-up the parsing throughput from 6k to 13k ops/milliseconds (meaning just 75 nanoseconds per parse operation).
When trying out this approach for other programming languages, I found your isbn3 NPM library.
Your benchmark script was not able to measure that tiny amount of time correctly, so I put a 1000x loop around the parsing like this:
My question is: Are you interested in rewriting your parsing engine?
Otherwise I would try to create a new npm package with that approach.
I compared your latest version of
isbn3
to the old npm libisbn
and then my temporary prototype using either of these different imports:This is the result on my machine with these three approaches:
ISBN3
ISBN (7 years old!!)
my prototype from https://github.com/creativecouple/isbn-validation-java/tree/tmp-javascript-version
So the old
isbn
package is still faster than your current version, but as you see it is possible to go sub-second for 5,640,000 parsing operations.The text was updated successfully, but these errors were encountered: