You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2023/03/17 13:38:42 UTC

[Bug 66532] New: [PATCH] Improve performance of SheetDataWriter

https://bz.apache.org/bugzilla/show_bug.cgi?id=66532

            Bug ID: 66532
           Summary: [PATCH] Improve performance of SheetDataWriter
           Product: POI
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: matthias.raschhofer@gmail.com
  Target Milestone: ---

Created attachment 38524
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=38524&action=edit
Patchset of SheetDataWriter

Performance tests showed that creating rows in a SXSSF sheet with lots of data
spend a substantial amount of cpu time escaping the strings to write using
#outputEscapedString. 

By simplifying the loop and avoiding to convert between string and codepoints a
bunch of times, we can improve the writing speed by a good amount.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 66532] [PATCH] Improve performance of SheetDataWriter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66532

--- Comment #4 from Matthias Raschhofer <ma...@gmail.com> ---
Thank you for your comments. I'm happy to use git, however I thought it was
readonly and I should provide patches here. I opened a pull request in git
(https://github.com/apache/poi/pull/443).

I attached a benchmark also comparing the performance against the change made
with https://github.com/apache/poi/pull/405. I think the difference is
significant.

I don't think there is an issue with the number of chars vs. the number of
codepoints, since the loop counter is increased in case the codepoint is in
fact a pair of characters. There are unit tests in the TestSheetDataWriter
asserting the correct behaviour for unicode surrogates as well as the
'replaceWithQuestionMark' behaviour.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 66532] [PATCH] Improve performance of SheetDataWriter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66532

--- Comment #3 from Matthias Raschhofer <ma...@gmail.com> ---
Created attachment 38525
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=38525&action=edit
Benchmark

The attached file contains a benchmark comparing the performance of the
proposed patch against previous iterations of the same method.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 66532] [PATCH] Improve performance of SheetDataWriter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66532

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #5 from PJ Fanning <fa...@yahoo.com> ---
Thanks Matthias - I'll close this based on what you provided in
https://github.com/apache/poi/pull/443 - if you could close that PR, it be
great.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 66532] [PATCH] Improve performance of SheetDataWriter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66532

--- Comment #2 from PJ Fanning <fa...@yahoo.com> ---
https://github.com/apache/poi/pull/405 is an unreleased perf change that may
improve perf time of existing code.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 66532] [PATCH] Improve performance of SheetDataWriter

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66532

--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
It's hard to read this patch on my phone but a quick look makes me think there
is a bug with use of string length - the number of chars as opposed the number
of codepoints. I'm very reluctant to take this change. Can you provide a jmh
benchmark to back up your claims? If the codepoint code is super slow, we could
consider an option where users configure whether they want char iteration or
codepoint iteration.

Is there any chance of using GitHub instead of patch files?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org