Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(818)

Issue 343000043: More assorted ICU4C DecimalFormat optimizations.

Can't Edit
Can't Publish+Mail
Start Review
Created:
6 years ago by sffc
Modified:
6 years ago
Reviewers:
andy.heninger
Base URL:
svn+icussh://source.icu-project.org/repos/icu/branches/shane/numberformat4/icu4c/source/
Visibility:
Public.

Description

More assorted ICU4C DecimalFormat optimizations.

Patch Set 1 #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+178 lines, -49 lines) Patch
M i18n/decimfmt.cpp View 48 chunks +119 lines, -44 lines 3 comments Download
M i18n/measunit.cpp View 2 chunks +6 lines, -1 line 2 comments Download
M i18n/number_decimfmtprops.cpp View 2 chunks +1 line, -1 line 1 comment Download
M i18n/unicode/decimfmt.h View 2 chunks +3 lines, -3 lines 0 comments Download
M test/intltest/numfmtst.h View 1 chunk +1 line, -0 lines 0 comments Download
M test/intltest/numfmtst.cpp View 4 chunks +48 lines, -0 lines 0 comments Download

Messages

Total messages: 2
sffc
6 years ago (2018-04-21 05:51:59 UTC) #1
sffc
6 years ago (2018-04-21 08:02:45 UTC) #2
https://codereview.appspot.com/343000043/diff/1/i18n/decimfmt.cpp
File i18n/decimfmt.cpp (left):

https://codereview.appspot.com/343000043/diff/1/i18n/decimfmt.cpp#oldcode1
i18n/decimfmt.cpp:1: // © 2018 and later: Unicode, Inc. and others.
I guess I should also port this value-checking logic to ICU4J?

https://codereview.appspot.com/343000043/diff/1/i18n/decimfmt.cpp#oldcode102
i18n/decimfmt.cpp:102: void
DecimalFormat::setParseAllInput(UNumberFormatAttributeValue value) {
A good thing to do in review is make sure that I am doing all the checks
correctly (i.e., no typos like checking the wrong property in the method).  I
think I got them all right but it's easy to miss one.

https://codereview.appspot.com/343000043/diff/1/i18n/decimfmt.cpp#oldcode1256
i18n/decimfmt.cpp:1256: if (++group == 3 && fFastData.cpGroupingSeparator != 0)
{
Having this at the end of the loop was causing strings like ",999" to be
printed.  Moving it to the beginning is correct.

https://codereview.appspot.com/343000043/diff/1/i18n/measunit.cpp
File i18n/measunit.cpp (left):

https://codereview.appspot.com/343000043/diff/1/i18n/measunit.cpp#oldcode1121
i18n/measunit.cpp:1121: initNoUnit("base");
The default constructor of MeasureUnit is called thousands and thousands of
times throughout the test suite, since every NumberFormatter has one as a member
field by value.  Squeezing every little bit of performance out of it is good. 
This change replaces a string comparison and binary search with direct setters.

https://codereview.appspot.com/343000043/diff/1/i18n/measunit.cpp
File i18n/measunit.cpp (right):

https://codereview.appspot.com/343000043/diff/1/i18n/measunit.cpp#newcode562
i18n/measunit.cpp:562: static const int32_t kBaseSubTypeIdx = 0;
I added this to the auto-generate function, which isn't in this review.

https://codereview.appspot.com/343000043/diff/1/i18n/number_decimfmtprops.cpp
File i18n/number_decimfmtprops.cpp (left):

https://codereview.appspot.com/343000043/diff/1/i18n/number_decimfmtprops.cpp...
i18n/number_decimfmtprops.cpp:94: eq = eq && minimumFractionDigits ==
other.minimumFractionDigits;
minFrac == 0 is sufficient for fastpath.  Moving it out of the mandatory
equivalents and into the optional equivalents with additional logic to handle
that case in decimfmt.cpp
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b