-
Notifications
You must be signed in to change notification settings - Fork 14
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
Investigate why running the wasm blob in Postject is slow #85
Comments
RaisinTen
added a commit
to RaisinTen/postject
that referenced
this issue
May 15, 2023
This change replaces the [`vecFromJSArray()`](https://emscripten.org/docs/api_reference/val.h.html?highlight=vecfromjsarray#_CPPv4N10emscripten10emscripten3val14vecFromJSArrayERK3val) call in `vec_from_val()` with a call to [`convertJSArrayToNumberVector()`](https://emscripten.org/docs/api_reference/val.h.html?highlight=convertjsarraytonumbervector#_CPPv4N10emscripten10emscripten3val28convertJSArrayToNumberVectorERK3val), which reduces the time consumption of Postject from ~30s to ~6s on a Mach-O Node.js binary when run on my x86_64 macOS. Fixes: nodejs#85 Refs: emscripten-core/emscripten#11119 Signed-off-by: Darshan Sen <raisinten@gmail.com>
This was referenced May 15, 2023
RaisinTen
added a commit
that referenced
this issue
May 18, 2023
* feat: make postject faster This change replaces the [`vecFromJSArray()`](https://emscripten.org/docs/api_reference/val.h.html?highlight=vecfromjsarray#_CPPv4N10emscripten10emscripten3val14vecFromJSArrayERK3val) call in `vec_from_val()` with a call to [`convertJSArrayToNumberVector()`](https://emscripten.org/docs/api_reference/val.h.html?highlight=convertjsarraytonumbervector#_CPPv4N10emscripten10emscripten3val28convertJSArrayToNumberVectorERK3val), which reduces the time consumption of Postject from ~30s to ~6s on a Mach-O Node.js binary when run on my x86_64 macOS. Fixes: #85 Refs: emscripten-core/emscripten#11119 Signed-off-by: Darshan Sen <raisinten@gmail.com> * fix: increase timeout to pass tests on Windows Refs: https://app.circleci.com/pipelines/github/RaisinTen/postject/7/workflows/4bfbf11d-4796-459d-a339-a28098670f37/jobs/77/tests Signed-off-by: Darshan Sen <raisinten@gmail.com> --------- Signed-off-by: Darshan Sen <raisinten@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See the discussion in nodejs/node#47741.
Measurements of injecting a 4KB resource into a Mach-O binary on an
x86_64
macOS with Node.js v20.1.0:Loading the Emscripten-generated script (https://github.com/emscripten-core/emscripten/blob/90d76db21200d42f5536bc3a01a22303e398d8b4/src/shell.js, https://github.com/emscripten-core/emscripten/blob/90d76db21200d42f5536bc3a01a22303e398d8b4/src/preamble.js, etc.):
postject/src/api.js
Line 25 in 2481868
takes ~50ms.
Getting the executable format -
postject/src/api.js
Line 32 in 2481868
postject/src/postject.cpp
Line 24 in 2481868
Injecting the resource -
postject/src/api.js
Lines 53 to 59 in 2481868
vec_from_val
call inpostject/src/postject.cpp
Line 96 in 2481868
parse
call inpostject/src/postject.cpp
Line 96 in 2481868
TLDR -
postject/src/postject.cpp
Lines 16 to 21 in 2481868
Replacing the
emscripten::vecFromJSArray<uint8_t>(value)
call atpostject/src/postject.cpp
Line 20 in 2481868
emscripten::vecFromJSArray<uint8_t>(value)
reduces the time consumption from ~30s to ~6s.The text was updated successfully, but these errors were encountered: