Re: [whatwg/fetch] Body.arrayBuffer([begin, end]) (#554)

The blob() case is more efficient by far in terms of what the browser can and does optimize.  Speaking for Gecko, the blob() call only creates a handle to the underlying file on disk.  No reads of the file's contents need to be performed before returning the blob.  This handle can be given to the new Response and passed across processes, allowing the target process to perform just the 1024-byte read directly, and without needing to involve the ServiceWorker or its global.

In contrast, the arrayBuffer() call will result in the entirety of "huge-file.mp4" being read from disk and exposed to the ServiceWorker and its global.  The read needs to complete before the new Response can be created and returned, and its contents may then need to be streamed between processes (unless some kind of underlying shared memory/copy-on-write thing is done, which I'm pretty confident Gecko will not do at the current time).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/554#issuecomment-308990694

Received on Friday, 16 June 2017 10:24:49 UTC