[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fop-dev
Subject:    DO NOT REPLY [Bug 43940] [PATCH] Faster method for double formatting
From:       bugzilla () apache ! org
Date:       2011-07-27 13:58:53
Message-ID: bug-43940-38666-4AU3h02ZQ8 () https ! issues ! apache ! org/bugzilla/
[Download RAW message or body]

https://issues.apache.org/bugzilla/show_bug.cgi?id=43940

--- Comment #12 from Ognjen Blagojevic <ognjen.d.blagojevic@gmail.com> 2011-07-27 13:58:53 UTC ---
Nice job, Julien.

I reviewed DoubleFormatUtil and DoubleFormatUtilTest. DoubleFormatUtil contains
requested static method formatDouble, and few other utility methods that may be
used for double maniupation.

As test case shows, all requested (and some additional) examples are formatted
right:

+ 0.0 should be rendered as "0" (true)
+ 0.1 should be rendered as "0.1" (true)
+ 1234.1 should be rendered as "1234.1" (true)
+ 1234.1234567 should be rendered as "1234.1235" (note the trailing 5!
Rounding!)
+ 1234.00001 should be rendered as "1234" (true)
+ 0.00001 should be rendered as "0.00001" (here you see the effect of the
+ "precision" parameter. (true, need to add test case)
+ 0.00000001 should be rendered as "0.00000001". (true)
+ 0.000000001 should be rendered as "0". (true)

Also, acceptance criteria are fulfilled:

+ The method has to prove to be faster than new DecimalFormat("0.######", new
DecimalFormatSymbols(Locale.US)).format(value) on Sun Java 1.4, 1.5 an 6.0.
(true)

1.4.2_05 - 672 ms for formatDecimal compared to 1782 ms ms for
DecimalFormat.format
1.5.0_11 - 562 ms for formatDecimal compared to 1625 ms for
DecimalFormat.format
1.6.0_24 - 485 ms for formatDecimal compared to 1188 ms for
DecimalFormat.format

Tested on Windows XP SP3, Intel Core 2 Duo, E6550, 2.33 GHz.


+ The method must be thread-safe. (true)

Static method, using only local variables.

+ The method must have a javadoc comment. (true)
+ It must be accompanied by a JUnit TestCase testing all aspects of the method.
(true)
+ It should not depend on any additional library not already in the dependency
(true)
list of Apache XML Graphics Commons (its destination in the end).

Commiters, could you please add attachments 1 and 2 to the code base. Note that
attachments 1 and 2 are for packages org.apache.xmlgraphics.util. If you prefer
putting them into package org.apache.fop.util, please change the package
declaration.


Attachments 3 and 4 are not tested, I propose that those attachments be part of
solution for bug #51150.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic