This project has moved and is read-only. For the latest updates, please go here.

Low performance & Huge memory consumption

Aug 18, 2011 at 10:53 AM
Edited Aug 18, 2011 at 10:54 AM

Thanks for the great tool!

However I run into a serious performance/memory issue. When trying to do the following (simply insert 2 empty rows below a row with "[Data]" value in one of its cells:


var workbook = new XLWorkbook("Report.xlsx");
var ws = workbook.Worksheets.Worksheet("Device Data");
IXLRow psirt_row = ws.Rows().Single(r => r.Cells().SingleOrDefault(c => c.Value.Equals("[Data]")) != null);

It took the library about 0.5 sec to simply open the file, about 3 secs to look up the needed row, another sec to insert two empty rows.
And the call to .Save hung the app altogether.. The memory consumption bumped up to 1.6 Gigs.. CPU usage was about 100% (GC seemingly is trying very hard =) ).


The input file (Report.xlsx) is tiny - 13.9 kBytes in size.

Did I do something wrong?

Aug 18, 2011 at 3:02 PM

If possible I'd like to take a look at that file to see what I can do because that's definitely not normal.

In the mean time please download the latest check-in which has major memory and performance improvements.

Aug 18, 2011 at 3:13 PM

I'll be glad to share it so you can take a look. I wrote a private message to you.

Aug 18, 2011 at 4:56 PM

I'll modify the row.Cells() to not return 16K cells. In the meantime you can rewrite your query to:

var psirt_row = ws.Rows().First(r => r.CellsUsed().Any(c => c.GetString().Equals("[Data]")));
Aug 18, 2011 at 7:05 PM

Thanks a lot!

With your correction the code performs much, much better :)

Still will be looking forward to the updated version. Hope I'll be able to implement all my uses cases with this really nice and easy-to-grasp API.