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

wasm_js: remove the separate codepath for Node.js and TLS caching #557

Merged
merged 17 commits into from
Dec 4, 2024

Conversation

newpavlov
Copy link
Member

@newpavlov newpavlov commented Dec 4, 2024

Acquire of "global" objects is relatively cheap (adds ~40 ns of overhead), so it make sense to do it on each call instead of trying to cache objects in a TLS variable.

Additionally, removes the separate codepath for Node.js since it fully supports the Web Crypto API since v19 (released 2022-10-18).

@newpavlov newpavlov changed the title wasm_js: remove TLS wasm_js: remove TLS and the separate codepath for Node.js Dec 4, 2024
@newpavlov newpavlov marked this pull request as ready for review December 4, 2024 22:10
@newpavlov
Copy link
Member Author

@daxpedda
Can you take a look? If you agree with the changes and have no suggestions, I will merge it.

I think we can leave additional optimization suggested by you here for a separate PR since I do not fully understand how to implement them (I am not very familiar with wasm-bindgen).

@daxpedda
Copy link
Contributor

daxpedda commented Dec 4, 2024

Ah, I thought you are going to merge #541 first.
Sure, I will take a look.

@newpavlov
Copy link
Member Author

I thought that when you wrote "Sure, I'm a fan of splitting things up." you meant that we should continue with this PR. :)

@newpavlov newpavlov changed the title wasm_js: remove TLS and the separate codepath for Node.js wasm_js: remove the separate codepath for Node.js and TLS caching Dec 4, 2024
Copy link
Contributor

@daxpedda daxpedda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are also some Node.js related leftovers on the Error type.

I thought that when you wrote "Sure, I'm a fan of splitting things up." you meant that we should continue with this PR. :)

Apologies, I probably didn't read carefully enough. I understood it just as a follow-up, not a replacement.

README.md Outdated Show resolved Hide resolved
src/backends/wasm_js.rs Outdated Show resolved Hide resolved
src/backends/wasm_js.rs Outdated Show resolved Hide resolved
src/backends/wasm_js.rs Show resolved Hide resolved
README.md Show resolved Hide resolved
src/backends/wasm_js.rs Outdated Show resolved Hide resolved
@newpavlov newpavlov merged commit 5fbfd2e into master Dec 4, 2024
53 checks passed
@newpavlov newpavlov deleted the wasm_js/simplify branch December 4, 2024 23:49
@daxpedda
Copy link
Contributor

daxpedda commented Dec 5, 2024

We entirely forgot the whole no_std support.
Will make a PR for that.

newpavlov pushed a commit that referenced this pull request Dec 5, 2024
In #557 we forgot to port the `no_std` support from #541.

This also adds running Clippy for `wasm32v1-none`.
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 this pull request may close these issues.

2 participants