-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
emrun stdio performance
I am compiling a legacy native library that also includes a large number of gtests. When running the gtest they write a lot to the stdio under emrun this is a performance bottleneck.
This bottle neck is created by emrun writing the stdio 3 places. the dom,console, and also posts an http request to the server.
Even eliminating the dom doesn't help because the writes can come so quickly the chrome will error because of so many requests being created.
In my example if i run the gtest wasm with --gtest_list_tests which does not run anything but lists the names of all the tests in the executable takes ~3 minutes with default emrun behavior.
By adding a simple --extern-post-js I am able to make the this take 1-2 seconds.
I am not sure if others have run into the stdio performance or not but this could be a useful feature to allow users to specify a stdio buffer limit
var process = cb => {
var lines = [];
var limit = 1000;
return (text, flush) => {
lines.push(text);
if(flush || lines.length > limit) {
cb(lines.join('\n'));
lines = [];
}
};
}
out = process(out);
err = process(err);
addOnExit(() => {
out('', true);
err('', true);
});