Stuk / jszip

Create, read and edit .zip files with Javascript
https://stuk.github.io/jszip/
Other
9.78k stars 1.3k forks source link

Why excel size is very large when we download using DataTables.net Html5Excel export option using JSZip? #387

Open saravan23 opened 7 years ago

saravan23 commented 7 years ago
  1. I've a data set of ~60,000 records with 20 columns.
  2. I'm using buttons export using Html5Excel. Also, i'm using JSZip as well.
  3. When i export the excel, the excel size is approximately 54 MB. However, when i open this excel and save as the file size is around 7 MB which is around 12 times lesser than the original downloaded file.
  4. Is there any way we can reduce the downloaded file size?
  5. Its taking around 1 minute to download in Chrome. However, this is completely failing in IE 11 and Edge browsers. Is there any alternates to download this much big file in IE 11 and Edge, as currently for our customers we can't suggest to use Chrome browser.
saravan23 commented 7 years ago

This is being tracked here as well https://datatables.net/forums/discussion/39534/

dduponchel commented 7 years ago

The default compression is STORE, meaning no compression of the content. Switching to DEFLATE should reduce the final size.

1 minute to generate a 54MB zip file seems a bit long. I suspect the use of binary strings or base64 somewhere. Which output format do you use ? blob ? base64 ?

saravan23 commented 7 years ago

Thank you for the response. I'm using v3.1.3 of JSZip. After changing to DEFLATE, apparently the size came down to 5.5 MB which is ~10 times lesser than the original size. However, in IE 11 and Edge browsers, still the file is not even opening.

Any other pointers on this to make this work in IE11/Edge browsers?

saravan23 commented 7 years ago

Here's demonstration link (http://live.datatables.net/najokiwa/1/edit) of the issue. you may please try this in IE11/Edge browsers. For testing purpose, I've cut down the data to 15k records. However, this is still failing.

The output format we're using is blob.

dduponchel commented 7 years ago

Thanks for the link. I don't have a lot of time to investigate right now, I'll try to do it this week or next week. What's the behavior in IE11/Edge ? Silently stopping ? Does the promise fail with an error ?

saravan23 commented 7 years ago

In IE/Edge, For 15k records while exporting - its taking around 7 to 8 minutes. However, this is really faster in chrome [which is taking around 5 to 6 seconds].

Any clues/thoughts on improving the performance on IE/Edge browsers while exporting excel of the large data sets?

dduponchel commented 7 years ago

After a quick profiling of the page on Edge, it seems a lot of time is spent doing string operations (strip in dataTables.buttons.js) or manipulating a DOM (_createNode in buttons.html5.js). This is outside of JSZip so I can't really comment on this part. I also don't know my profiling is relevant: I used the Edge VM on a linux laptop and everything was quite slow (and may not represent a real Edge installation).