Replies: 3 comments 6 replies
-
Comparing safari to chrome is like comparing canary against IE9 Safari don't support downloading files generated by service worker so what it dose instead is to accumulate all chunks into one Blob and download everything at once. (without service worker) So yea, safari is a bit faster but you are not able to download small bits of pieces periodically. Safari needs to buffer up everything into a Blob and download it afterwards |
Beta Was this translation helpful? Give feedback.
-
where dose your data come from? the server? |
Beta Was this translation helpful? Give feedback.
-
I promised to do some performance tests. To make things more interesting, I used a payload of 500MB, constructed with the function shown above. I logged Here's the download time and JS memory consumption for the StreamSaver.js based solution:
This looks rather good from the JS heap perspective. Browser memory consumption (according to the Chrome Task Manager) rose up to 6GB, though, but everything worked flawlessly. Only if it wouldn't take so extremely long.
That's what you expect regarding memory consumption, I guess. Creating a Blob from the Array doubles your heap memory usage, but everything worked and it was fast, really, really fast. (I also tested your So, I guess I'll end up with a dual approach in my application: For payloads up to several hundred MB, I'll go the very fast Blob download route, while using StreamSaver.js for really huge datasets. |
Beta Was this translation helpful? Give feedback.
-
In my app I'm dealing with large data sets. I learned that with StreamSaver.js downloading is rather slow on Chrome compared to Safari. I've done some tests on macOS and Windows. The downloaded payload consists of 1 million lines, each 100 bytes long, resulting in a 100MB file.
macOS Big Sur (MacBook Air M1)
Chrome: 76s
Safari: 17s
Windows 10 (Ryzen 3600)
Chrome: 90s
Edge: 131s
On macOS I did also tests with 10MB files, where Chrome took about 8s and Safari downloaded instantly. All those download times were taken manually.
Trying to find out what takes that long, I measured the time between createWriteStream and stream closing as can be seen in this code:
The differences were modest, Safari needed about 1 second, Chrome about 2.
I even wrote my own simple implementation of a service worker downloader where the download isn't streamed. Chrome now downloads 100MB within less than a second.
Do you have any ideas why downloading takes so long, especially on Chrome?
Beta Was this translation helpful? Give feedback.
All reactions