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

Which functions should be faster? #21

Open
paulmillr opened this issue Sep 13, 2023 · 9 comments
Open

Which functions should be faster? #21

paulmillr opened this issue Sep 13, 2023 · 9 comments
Labels
question Further information is requested

Comments

@paulmillr
Copy link
Owner

paulmillr commented Sep 13, 2023

If your app has is bottlenecked because of scure-base, write a comment here.

The current architecture is cool and readable, but not the fastest one. For example, hex.decode is slower than in noble-hashes / noble-curves. hex decoding is not used anywhere here, but it is used in scure-btc-signer. base64 is also a bit slow, but so far has not been a bottleneck.

@paulmillr paulmillr added the question Further information is requested label Sep 13, 2023
@AlexErrant
Copy link

Perhaps out of scope and outside your comfort area, but I wonder if wasm offers any worthy advantage. Might be that the interop cost isn't worth it for like, 512 bits though.

@paulmillr
Copy link
Owner Author

No wasm. Wasm creates opaque binaries that are hard to inspect and may contain malware.

@AlexErrant
Copy link

Sorry for going further off-topic, but doesn't that argument also apply to minfied JS? Devs typically inspect source code, not compiled/transpiled output. Also, you don't have to ship opaque binaries - there was some drama recently in the Rust ecosystem when Serde tried to do that.

@paulmillr
Copy link
Owner Author

doesn't that argument also apply to minified JS

yes. also to all build tools. My goal is to provide secure, audited / auditable, small packages. It's up to user to use additional build tools

you don't have to ship opaque binaries

What do you mean? If I publish package with wasm, it would be necessary to include wasm-compiled binaries themselves in the package. That's industry standard. We've (as NPM community) moved away from building packages on user machines because node-gyp shown that it's too unreliable.

@AlexErrant
Copy link

Ah derp you're right. I got lost in Rust land for the past few days and lost (or gained) some brain cells.

Now that I think about it... its kinda insane that NPM ships opaque binaries.

Javascript.

@paulmillr
Copy link
Owner Author

Sad!

@paulmillr
Copy link
Owner Author

#30

@o-az
Copy link

o-az commented May 1, 2024

are there any published benchmarks for this library? Looking for something like this https://www.xaymar.com/articles/2020/12/08/fastest-uint8array-to-hex-string-conversion-in-javascript/

@paulmillr
Copy link
Owner Author

npm run bench

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

No branches or pull requests

3 participants