https://issues.apache.org/bugzilla/show_bug.cgi?id=54137
Priority: P2
Bug ID: 54137
Assignee: [email protected]
Summary: PATCH Patch for performance issues with DataFormatter
Fractions
Severity: normal
Classification: Unclassified
Reporter: [email protected]
Hardware: PC
Status: NEW
Version: 3.9-dev
Component: POI Overall
Product: POI
Created attachment 29588
--> https://issues.apache.org/bugzilla/attachment.cgi?id=29588&action=edit
Initail patch file to limit impact
DataFormatter Fractions formats that use 4 digits ("# #/####) or more are VERY
slow. 4 digits takes around 1 second to process, 5 digits 100 seconds and so
on.
To compound the issue:
a) if there is a -ve format (N in the P;NZ;T format), the length of the N
format is added to the digit count, resulting in a locked up CPU. For example
"# #/#;# #/#" is taken to be the same as "# #/#######" (7 digits).
b) Custom text is also counted. For example: "# #/#"Credits" is taken to be
"# #/##########"
The attached patch tries to limit the impact of the issue rather than fix the
code that calculates the fraction:
- It limits the number of digits to 4 (additional # chars are ignored)
- It splits of the N part of the format (if it exists) from the P part
- It ignores any custom text (appears not to be generally supported elsewhere)
- Adds support for negative numbers
- Fixes a bug in calculations of negative numbers
- Adds a number of unit tests for fractions
- When there are both P and N parts, a FractionFormat is only now used if both
parts include #/# OR ?/?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]