FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

wasi: use WasmMemoryObject handle for perf by devsnek · Pull Request #43544 · nodejs/node · GitHub

/ node Public

wasi: use WasmMemoryObject handle for perf - #43544

Merged
devsnek merged 1 commit into
mainfrom
use-wasm-memory-object-type
Jun 25, 2022
Merged

wasi: use WasmMemoryObject handle for perf#43544
devsnek merged 1 commit into
mainfrom
use-wasm-memory-object-type

Conversation

devsnek commented Jun 23, 2022

Copy link
Copy Markdown
Member

Store WebAssembly.Memory handle as a WasmMemoryObject, which lets us directly grab the ArrayBuffer instead of doing a property lookup in this hot path.

devsnek requested a review from cjihrig June 23, 2022 06:21

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/wasi

nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jun 23, 2022
devsnek force-pushed the use-wasm-memory-object-type branch 3 times, most recently from 0424be9 to 49c3b76 Compare June 23, 2022 06:32
devsnek force-pushed the use-wasm-memory-object-type branch 2 times, most recently from d7ead7a to 5a05d10 Compare June 23, 2022 13:53
Comment thread src/node_wasi.cc

Local<ArrayBuffer> ab = prop.As<ArrayBuffer>();
std::shared_ptr<BackingStore> backing_store = ab->GetBackingStore();
Local<WasmMemoryObject> memory = PersistentToLocal::Strong(this->memory_);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

tiny and very ignorable style nit:

Suggested change
Local<WasmMemoryObject> memory = PersistentToLocal::Strong(this->memory_);
Local<WasmMemoryObject> memory = PersistentToLocal::Strong(memory_);

More directly, why are we not going on step further and storing the std::shared_ptr<BackingStore> here? That should be even faster.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

the arraybuffer gets detached every time the wasm grows its memory. very annoying problem, maybe it will be fixed one day: https://github.com/tc39/proposal-resizablearraybuffer#sync-up-capability-with-webassembly-memorygrow

This comment was marked as outdated.

This comment was marked as outdated.

devsnek force-pushed the use-wasm-memory-object-type branch from c440735 to 98a1262 Compare June 25, 2022 07:03

Copy link
Copy Markdown
Collaborator

PR-URL: #43544
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
devsnek force-pushed the use-wasm-memory-object-type branch from 98a1262 to 4778831 Compare June 25, 2022 18:01
devsnek merged this pull request into main Jun 25, 2022
devsnek deleted the use-wasm-memory-object-type branch June 25, 2022 18:01
devsnek added a commit that referenced this pull request Jun 25, 2022
PR-URL: #43544
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
targos pushed a commit that referenced this pull request Jul 12, 2022
PR-URL: #43544
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
targos pushed a commit that referenced this pull request Jul 20, 2022
PR-URL: #43544
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
targos pushed a commit that referenced this pull request Jul 31, 2022
PR-URL: #43544
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL