Conversation
|
Still having this issue with the proposed workaround. Any tips? |
|
Could you merge |
Thanks, I merged. |
|
Can this merge now? |
|
is this being worked on anymore? |
|
What do you waiting for? @Stuk set-immediate-shim is unacceptably slow. Or setimmediate (of this pull request) is too big for you? Since Lines 404 to 408 in 38f8373 ...just use the follow code instead of importing a library: const setImmediate = globalThis.setImmediate || /*#__PURE__*/ (function() {
const {port1, port2} = new MessageChannel();
const queue = [];
port1.onmessage = function() {
const callback = queue.shift();
callback();
};
return function setImmediateLike(callback) { // Simplified implementation: only callback argument.
port2.postMessage(null);
queue.push(callback);
};
})();The implementation of ES5 version to pass linter: var setImmediate = typeof setImmediate === "function" ? setImmediate : /*#__PURE__*/ (function() {
var channel = new MessageChannel();
var port1 = channel.port1;
var port2 = channel.port2;
var queue = [];
port1.onmessage = function() {
var callback = queue.shift();
callback();
};
return function setImmediateLike(callback) { // Simplified implementation: only callback argument.
port2.postMessage(null);
queue.push(callback);
};
})();Just put it before 404 line (also remove the import and the dependency): Line 404 in 38f8373 All tests are passed. Works properly. And fast (as expected). |
Use larger chunkSize(64K) increase generateasync perf。
And use a robust setimmediate polyfill could increase generateasync perf of the zip with lots of chunks (min.js just 1KB larger ).
(Current setImmediate polyfill (after v3.15) using setTimeout(fn, 0) cause 4ms+ delay(browser) or 1ms delay(node.js) each chunk (current 16K size), see perf demo).
This PR may resolve the issue #617.