Skip to content

Investigate why running the wasm blob in Postject is slow #85

@RaisinTen

Description

@RaisinTen

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:

TLDR -

std::vector<uint8_t> vec_from_val(const emscripten::val& value) {
// TODO(dsanders11) - vecFromJSArray incurs a copy, so memory usage is higher
// than it needs to be. Explore ways to access the memory
// directly and avoid the copy.
return emscripten::vecFromJSArray<uint8_t>(value);
}
is where the bottleneck is.

Replacing the emscripten::vecFromJSArray<uint8_t>(value) call at

return emscripten::vecFromJSArray<uint8_t>(value);
with a call to emscripten::vecFromJSArray<uint8_t>(value) reduces the time consumption from ~30s to ~6s.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions