FlowingCode / GridExporterAddon

Other
10 stars 8 forks source link

Bad Performance on huge grids #82

Closed dominik42 closed 7 months ago

dominik42 commented 8 months ago

I use the grid exporter for my Vaadin 24 apps and it's really working well for nearly all use cases, except one grid with large data sets (3000 rows). Exporting this grid is unusable due to the bad performance (> 60s). I profiled the execution with VisualVM and its turned out, that

ExcelInputStreamFactory.fillData

and there the call for

sheet.shiftRows

is responsible for the huge time needed. Why is such a call neded and is there something I can fasten in order to make it work as for small data sets ?

kind regrads Dominik

P.S.: as workaround, please provide a hook/callback/listener for a FINISHED event of generating the stream resource so one can show a progressBar or something in the meantime.

mlopezFC commented 8 months ago

Hi. The call for sheet.shiftRows is needed because the data is "inserted" in the template so the rows below are not overwritten. One possible workaround is this one. Basically to create a temp sheet, copy all the rows bellow to it, insert all the rows and then append at the end the rows from the temp sheet. Another workaround would be to configure a flag so the shifting is not done (maybe you don't need a footer). I think that we could implement your suggested workaround first so you could show a progress bar.

dominik42 commented 8 months ago

Hi, thank you for your response. As I understand, the workaround you mentioned first has to be implemented by you or your team direct within the addon, right ? Maybe a better workaround could be to allow a plain target file without any template header and/or footer rows within. In this case, the addon only writes the plain data rows and there is no need to shift any rows.