Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Issue 619005: Fast algorithm for double->string conversion. (Closed)

Created:
10 years, 10 months ago by Florian Loitsch
Modified:
8 years, 8 months ago
CC:
v8-dev
Visibility:
Public.

Description

Fast algorithm for double->string conversion. Committed: http://code.google.com/p/v8/source/detail?r=4090

Patch Set 1 #

Total comments: 18

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 40

Patch Set 4 : '' #

Total comments: 6

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Patch Set 8 : '' #

Patch Set 9 : '' #

Patch Set 10 : '' #

Total comments: 28

Patch Set 11 : '' #

Patch Set 12 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+4188 lines, -3 lines) Patch
M src/SConscript View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
A src/cached_powers.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +119 lines, -0 lines 0 comments Download
M src/checks.h View 2 3 4 5 6 7 8 9 10 2 chunks +22 lines, -0 lines 0 comments Download
M src/conversions.cc View 1 2 3 4 5 6 7 8 3 chunks +13 lines, -3 lines 0 comments Download
A src/diy_fp.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +136 lines, -0 lines 0 comments Download
A src/double.h View 1 2 3 4 5 6 7 1 chunk +166 lines, -0 lines 0 comments Download
M src/globals.h View 2 3 4 5 6 7 8 1 chunk +5 lines, -0 lines 0 comments Download
A src/grisu3.h View 1 2 3 4 5 6 7 1 chunk +55 lines, -0 lines 0 comments Download
A src/grisu3.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +477 lines, -0 lines 0 comments Download
A src/powers_ten.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +2460 lines, -0 lines 0 comments Download
M test/cctest/SConscript View 2 3 4 5 6 7 8 1 chunk +3 lines, -0 lines 0 comments Download
A test/cctest/test-diy_fp.cc View 2 3 4 5 6 7 8 9 10 1 chunk +66 lines, -0 lines 0 comments Download
A test/cctest/test-double.cc View 2 3 4 5 6 7 8 9 10 1 chunk +200 lines, -0 lines 0 comments Download
A test/cctest/test-grisu3.cc View 2 3 4 5 6 7 1 chunk +174 lines, -0 lines 0 comments Download
A tools/generate-ten-powers.scm View 2 3 4 5 6 7 8 9 10 11 1 chunk +285 lines, -0 lines 0 comments Download
M tools/gyp/v8.gyp View 2 3 4 5 6 7 8 4 chunks +6 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
Florian Loitsch
This is not the final version of the patch. In particular powers_ten.h and cached_powers.h are ...
10 years, 10 months ago (2010-02-17 12:05:57 UTC) #1
William Hesse
Here are some comments. http://codereview.chromium.org/619005/diff/1/3 File src/conversions.cc (left): http://codereview.chromium.org/619005/diff/1/3#oldcode684 src/conversions.cc:684: // efficiently, we probably have ...
10 years, 10 months ago (2010-02-18 10:21:12 UTC) #2
Søren Thygesen Gjesse
http://codereview.chromium.org/619005/diff/1/5 File src/SConscript (right): http://codereview.chromium.org/619005/diff/1/5#newcode67 src/SConscript:67: grisu3.cc When adding new files please update the other ...
10 years, 10 months ago (2010-02-18 10:29:38 UTC) #3
floitsch
Cleaner version of patch. I still would like to add a little bit of functionality, ...
10 years, 10 months ago (2010-02-19 14:50:05 UTC) #4
Lasse Reichstein
Style and nitpick comments only. http://codereview.chromium.org/619005/diff/6030/6036 File src/diy_fp.h (right): http://codereview.chromium.org/619005/diff/6030/6036#newcode68 src/diy_fp.h:68: // are only used ...
10 years, 10 months ago (2010-02-22 11:31:36 UTC) #5
Florian Loitsch
I have addressed all mentioned issues. Please give it another look. http://codereview.chromium.org/619005/diff/6030/6036 File src/diy_fp.h (right): ...
10 years, 10 months ago (2010-02-22 15:52:52 UTC) #6
fschneider
Interesting stuff! A few random drive-by comments. http://codereview.chromium.org/619005/diff/6030/6032 File src/conversions.cc (right): http://codereview.chromium.org/619005/diff/6030/6032#newcode392 src/conversions.cc:392: decimal_rep = ...
10 years, 10 months ago (2010-02-22 16:25:24 UTC) #7
Florian Loitsch
The .h files do not seem to follow V8 (and Google) standards. Any suggestions on ...
10 years, 10 months ago (2010-02-23 09:05:10 UTC) #8
Florian Loitsch
updated to latest revision. Mostly small changes. I have another patch pending for conversions.cc which ...
10 years, 9 months ago (2010-03-04 11:52:30 UTC) #9
William Hesse
Everything except grisu3.cc reviewed. http://codereview.chromium.org/619005/diff/10032/10037 File src/cached_powers.h (right): http://codereview.chromium.org/619005/diff/10032/10037#newcode42 src/cached_powers.h:42: // The following defines "implement" ...
10 years, 9 months ago (2010-03-09 12:21:57 UTC) #10
William Hesse
LGTM. http://codereview.chromium.org/619005/diff/10032/10035 File src/grisu3.cc (right): http://codereview.chromium.org/619005/diff/10032/10035#newcode56 src/grisu3.cc:56: static bool RoundWeed(char* buffer, int len, uint64_t wp_W, ...
10 years, 9 months ago (2010-03-09 13:22:04 UTC) #11
Florian Loitsch
I have addressed all your concerns. Please have another look. http://codereview.chromium.org/619005/diff/10032/10037 File src/cached_powers.h (right): http://codereview.chromium.org/619005/diff/10032/10037#newcode42 ...
10 years, 9 months ago (2010-03-09 15:32:00 UTC) #12
floitsch
8 years, 8 months ago (2012-04-10 15:54:33 UTC) #13
Sorry about the noise. Just discovered that there were still comments pending on
this review.

https://chromiumcodereview.appspot.com/619005/diff/6030/src/diy_fp.h
File src/diy_fp.h (right):

https://chromiumcodereview.appspot.com/619005/diff/6030/src/diy_fp.h#newcode68
src/diy_fp.h:68: // are only used for rounding the first 64 bits.
On 2010/02/22 11:31:36, Lasse Reichstein wrote:
> Which bits are first and last? Do you mean low and high/most or least
> signficant?

Done.

https://chromiumcodereview.appspot.com/619005/diff/6030/src/diy_fp.h#newcode69
src/diy_fp.h:69: const uint64_t kM32 = 0xFFFFFFFF;
On 2010/02/22 11:31:36, Lasse Reichstein wrote:
> Put a "u" on the end of the literal to make it unsigned.

Done.

https://chromiumcodereview.appspot.com/619005/diff/6030/src/double.h
File src/double.h (right):

https://chromiumcodereview.appspot.com/619005/diff/6030/src/double.h#newcode31
src/double.h:31: #include "diy_fp.h"
On 2010/02/22 11:31:36, Lasse Reichstein wrote:
> For consistency with the remaining code, please don't include .h files from .h
> files. Instead include the them both in any file that uses this .h file.

Done.

https://chromiumcodereview.appspot.com/619005/diff/6030/src/double.h#newcode36
src/double.h:36: typedef union {
On 2010/02/22 11:31:36, Lasse Reichstein wrote:
> Using a union to convert is bound to give problems with strict-aliasing (if we
> ever get to enabling that).
> Have you considered using the BitCast template instead?
> It uses memcpy to copy the bits, but is optimized very efficiently by
compilers.

Done.

https://chromiumcodereview.appspot.com/619005/diff/6030/src/double.h#newcode58
src/double.h:58: static const int kSignificandSize = 52;  // excluding the
hidden bit
On 2010/02/22 11:31:36, Lasse Reichstein wrote:
> Format comments as full sentences (capital start letter, full stop at end).

Done.

https://chromiumcodereview.appspot.com/619005/diff/6030/src/double.h#newcode64
src/double.h:64: DiyFp AsDiyFp() const {
On 2010/02/22 11:31:36, Lasse Reichstein wrote:
> Do you have any suggested pronunciation of DiyFp? :)

Do It Yourself Floating Point. This name is copied from the associated paper. I
could change it, though.

https://chromiumcodereview.appspot.com/619005/diff/6030/src/globals.h
File src/globals.h (right):

https://chromiumcodereview.appspot.com/619005/diff/6030/src/globals.h#newcode103
src/globals.h:103: //      write GRISU_UINT64_C(0x12345678,90123456);
On 2010/02/22 11:31:36, Lasse Reichstein wrote:
> GRISU -> V8_2PART

Done.

https://chromiumcodereview.appspot.com/619005/diff/6030/src/globals.h#newcode104
src/globals.h:104: #define V8_2PART_UINT64_C(a, b)  (((static_cast<uint64_t>(a)
<< 32) + 0x ## b))
On 2010/02/22 11:31:36, Lasse Reichstein wrote:
> Put a "## u" after the b to make it an unsigned constant. Just to be safe.

Done.

https://chromiumcodereview.appspot.com/619005/diff/6030/src/grisu3.cc
File src/grisu3.cc (right):

https://chromiumcodereview.appspot.com/619005/diff/6030/src/grisu3.cc#newcode167
src/grisu3.cc:167: case 32:
On 2010/02/22 11:31:36, Lasse Reichstein wrote:
> For readability, could you reverse the order of the cases in each group, so
they
> come in decreasing order

Done.

https://chromiumcodereview.appspot.com/619005/diff/6030/src/grisu3.cc#newcode447
src/grisu3.cc:447: int K;
On 2010/02/22 11:31:36, Lasse Reichstein wrote:
> Lower case variable names (and preferably not single-letter names).

Done.

https://chromiumcodereview.appspot.com/619005/diff/6030/src/powers_ten.h
File src/powers_ten.h (right):

https://chromiumcodereview.appspot.com/619005/diff/6030/src/powers_ten.h#newc...
src/powers_ten.h:2: // command used:  tools/generate-ten-powers --from -308 --to
342 --mantissa-size 64 --round round -o src/powers_ten.h
On 2010/02/22 11:31:36, Lasse Reichstein wrote:
> Is this line correct (or should there be a .scm after the file name?).
The scm file has to be compiled first. So this line is correct.

https://chromiumcodereview.appspot.com/619005/diff/6030/src/powers_ten.h#newc...
src/powers_ten.h:3: 
On 2010/02/22 11:31:36, Lasse Reichstein wrote:
> Even if it's generated, do generate it with some newlines.
> It's going to blow someone's editor :)
> 
> Also, does it lint? (Or how is it omitted from lint checking?)
Will fix output so it lints.

https://chromiumcodereview.appspot.com/619005/diff/7002/src/cached_powers.h
File src/cached_powers.h (right):

https://chromiumcodereview.appspot.com/619005/diff/7002/src/cached_powers.h#n...
src/cached_powers.h:76: if (!found && (gamma - alpha + 1 >=
GRISU_CACHE_MAX_DISTANCE(8))) {
On 2010/02/22 16:25:24, fschneider wrote:
> Remove. This is the same as:
> 
> COMPUTE_FOR_CACHE(8)
> 
> which you have already below.
> 

Done.

Powered by Google App Engine
This is Rietveld 408576698