Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

Commented Unassigned: Improve performance [9425]

$
0
0
Hi
There is room for performance improvements in ClosedXML.

To create a performance base line I updated the sandbox example in the branch https://closedxml.codeplex.com/SourceControl/network/forks/AlbinSunnanbo/closedxml?branch=Performance_Example to create a Excel document similar to our production code
(See change set https://closedxml.codeplex.com/SourceControl/network/forks/AlbinSunnanbo/closedxml/changeset/6aedcc8946cc210a4f81224f8e65f2f4feb0ee10 )

I created a pull request with some low hanging fruit fixes: https://closedxml.codeplex.com/SourceControl/network/forks/AlbinSunnanbo/closedxml/contribution/8065

Before the pull request the execution time on my computer was 9.8 seconds, with the pull request applied the execution time was 6.7 seconds. That's an overall 30% improvement on a generate + save cycle.

I have some further fixes in the works, I'll add comments to this issue when the are ready.

// Albin Sunnanbo @ Kentor
Comments: I have looked on XLCell.GetStyle(). It is called from XLColumn.AjustToContents in three locations. All locations use the Style in a read only fashion. However GetStyle does some deep copying (I assume to make it safe to update). This is a bit expensive. I made a prof of concept to bypass the deep copy in https://closedxml.codeplex.com/SourceControl/network/forks/AlbinSunnanbo/closedxml/changeset/5a0007ab6fc55bcc31e0af8b6c0c0bfc55309e5e It speed things up more than 10%, my example is now down to 5 seconds flat. That's good. The bad thing is that my proof of concept punches big holes in the architecture. I don't like big holes. I'd like to create a read only get style, returning an interface IXLReadOnlyStyle or something like that, but I can't figure out how to get it read only all the way down. So that IXLReadOnlyStyle only exposes IXLReadOnlyAlignment and so on. Its a known problem that you can't vary return types in your interfaces like that. Unless you have a good idea I'm prepared to to leave the style handling as it was. When looking at the big picture I see that the Save part now takes about 2/3 of the total execution time. The save part has a much more spread out execution pattern, no big chunks making up most of the time. It would have been fun to get down to 4.9 seconds (50% reduction), but currently I don't have the time to invest to get there as it would require me to get a much more thorough understanding of the code base to get there. In my opinion you may close the issue as done. // Albin

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>