Hmm. I should have expected this; it has major performance problem because stream piping by design heavily depends on promises. So cases like WPT /fetch/api/response/many-empty-chunks-crash.html will have to wait on at least 40,000 microtasks sequentially to finish, while it finishes instantly with the current FetchStreamReader. Points where we wait on promises: 1. PipeToPump::OnReadFulfilled waits on a `Promise.resolve()` to make it async; we can skip this. 1. PipeToPump::Read waits on `writer.ready()` to make sure the previous write is ended. Can we somehow allow `WritableStreamToOutput::OnOutputStreamReady` to trigger the next read immediately when done? 🤔
Bug 1825763 Comment 7 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Hmm. I should have expected this; it has major performance problem because stream piping by design heavily depends on promises. So cases like WPT /fetch/api/response/many-empty-chunks-crash.html will have to wait on at least 40,000 microtasks sequentially to finish, while it finishes instantly with the current FetchStreamReader. Points where we wait on promises: 1. PipeToPump::OnReadFulfilled waits on a `Promise.resolve()` to make it async; we can skip this. 1. PipeToPump::Read waits on `writer.ready()` to make sure the previous write is ended. Can we somehow allow `WritableStreamToOutput::OnOutputStreamReady` to trigger the next read immediately when done? 🤔 1. WritableStream also will wait for inFlightWriteRequest to end, which is also a promise that is resolved after a write promise resolves.