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

New Post: AdjustToContent is very slow

$
0
0
@DeLeon, can you elaborate on the threading issues?
I can't find no threading in ClosedXml.

I have the same issue with AdjustToContents beeing slow.
We generate a quite large excel sheet. ~20k rows and 50 columns.
For most of our columns the data is quite uniform and adjusting only the top few 100 would be enough, but some of our columns are quite sparse. Mostly empty, but some rows have long strings. If we don't get any strings in the top x rows the width adjustment of that column would be way of.

I'm considering to invest some time to create a pull request with a few performance improvements in this area.
I have a few options that I'm considering.
  1. Move the creation of the graphics object from GraphicsUtils.MeasureString to XLColumn.AdjustToContents and pass the graphics along with the font cache
  2. Create a dictionary from <IXLFontBase, string> to SizeF to cache the size of strings to speed up adjustment when there are lots of duplicates.
  3. Sort the columns by simple string character count and measure the top x% to make it more likely to find the longest columns.
However before I start out I'm curios to hear about the threading issues to make sure I don't mess anything up.

By the way, I can't find any contributor guide lines. Anything special to think about more than to make sure the code looks tidy and the tests are green?

Viewing all articles
Browse latest Browse all 1877

Trending Articles



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