Skip to content
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

Consider using native node:zlib.crc32 when available #34

Open
thejoshwolfe opened this issue Oct 20, 2024 · 2 comments · May be fixed by #37
Open

Consider using native node:zlib.crc32 when available #34

thejoshwolfe opened this issue Oct 20, 2024 · 2 comments · May be fixed by #37

Comments

@thejoshwolfe
Copy link

Hi maintainers! I'm a big fan of the simplicity of this package, and I've been using it for years in my software.

It's come to my attention in thejoshwolfe/yazl#82 that node now has a builtin native crc32 API in the zlib package. It looks like the two implementations agree on the math, although the type semantics of the APIs are of course subtly different:

console.log(require("node:zlib").crc32("hello")); // 907060870
console.log(require("buffer-crc32").unsigned("hello")); // 907060870

Would you consider adding a special case for using the native implementation when it's available and falling back to the js implementation otherwise? If that doesn't seem like it makes sense to include in this package, I'll look into doing it in my own code.

If you are interested, would you mind if I opened a PR? (Also, are you interested in a PR that upgrades the tap dependency? It looks like there's a lot of security vulnerabilities in the 6 year old version used in this package.)

@kibertoad
Copy link
Collaborator

PR would definitely be appreciated!

can you benchmark native vs js perf, btw?

@thejoshwolfe
Copy link
Author

PR would definitely be appreciated!

can you benchmark native vs js perf, btw?

@kibertoad Take a look at #36 and #37 when you get a chance! (and maybe #35.)

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

Successfully merging a pull request may close this issue.

2 participants