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

Issue 5413043: code review 5413043: big/nat: Improve decimal string output from O(N^2) to ... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 6 months ago by dga
Modified:
12 years, 6 months ago
Reviewers:
mtj1, gri, golang-dev
CC:
golang-dev
Visibility:
Public.

Description

big/nat: Improve decimal string output from O(N^2) to something less Changes the decimal string output from successive div/mod to divide-and-conquer by a large power of 10 of size roughly half the number of decimal digits in the nat. Uses this algorithm until 4096 bits, at which point it reverts to the prior successive div/mod algorithm. No change to times for "small" nats, but significant for thousands of bits or more: Before: big.BenchmarkStringShort10 100000 26828 ns/op big.BenchmarkStringMedium10 500 3246320 ns/op big.BenchmarkStringLong10 5 509510600 ns/op After: big.BenchmarkStringShort10 100000 28988 ns/op big.BenchmarkStringMedium10 2000 1150566 ns/op big.BenchmarkStringLong10 20 89172750 ns/op

Patch Set 1 #

Patch Set 2 : diff -r 80e9ed9f7989 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+138 lines, -36 lines) Patch
M src/pkg/math/big/nat.go View 1 4 chunks +138 lines, -36 lines 0 comments Download

Messages

Total messages: 7
dga
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 6 months ago (2011-11-17 22:38:31 UTC) #1
gri
Dave; I might be wrong but I think this idea is already represented in the ...
12 years, 6 months ago (2011-11-17 23:00:19 UTC) #2
mtj1
Yes this is the case. Coded, submitted, and faster. Uses powers of bigbase**(2**k) for 0<=k ...
12 years, 6 months ago (2011-11-17 23:29:54 UTC) #3
dga
Ah! Now I see - it must be CL 4634075. mtj's code is faster and ...
12 years, 6 months ago (2011-11-17 23:36:12 UTC) #4
mtj1
Oh, for some color, the code was completed (code, tests, tuning with and without bounds ...
12 years, 6 months ago (2011-11-17 23:38:44 UTC) #5
gri
Apologies for providing the wrong CL. I will use Michael Jones' CL (which has been ...
12 years, 6 months ago (2011-11-17 23:50:20 UTC) #6
dga
12 years, 6 months ago (2011-11-18 00:29:54 UTC) #7
*** Abandoned ***
Sign in to reply to this message.

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