1
0
mirror of https://github.com/golang/go synced 2024-09-23 21:30:18 -06:00
go/doc
Nigel Tao a2eb53c571 strconv: use the Eisel-Lemire ParseFloat algorithm
Also fix BenchmarkAtof64Random* to initialize the test data when none
of the TestAtof* tests are run.

Passing "go test -test.count=5 -test.run=xxx -test.bench=Atof64" on to
benchstat:

name                  old time/op  new time/op  delta
Atof64Decimal-4       47.9ns ± 0%  48.3ns ± 1%     ~     (p=0.238 n=4+5)
Atof64Float-4         58.3ns ± 3%  57.7ns ± 0%     ~     (p=0.151 n=5+5)
Atof64FloatExp-4       107ns ± 0%    71ns ± 1%  -33.89%  (p=0.016 n=4+5)
Atof64Big-4            163ns ± 0%   166ns ± 2%     ~     (p=0.159 n=4+5)
Atof64RandomBits-4     299ns ± 1%   166ns ± 1%  -44.41%  (p=0.008 n=5+5)
Atof64RandomFloats-4   188ns ± 1%   144ns ± 0%  -23.03%  (p=0.008 n=5+5)

The canada.json file from github.com/miloyip/nativejson-benchmark is
full of geospatial coordinates (i.e. numbers). With this program:

    src, _ := ioutil.ReadFile("canada.json")
    for i := 0; i < 5; i++ {
        now := time.Now()
        for j := 0; j < 10; j++ {
            dst := interface{}(nil)
            if err := json.Unmarshal(src, &dst); err != nil {
                log.Fatal(err)
            }
        }
        fmt.Println(time.Since(now))
    }

Median of the 5 printed numbers, lower is better.
Before: 760.819549ms
After:  702.651646ms
Ratio:  1.08x

The new detailedPowersOfTen table weighs in at 596 * 16 = 9536 bytes,
but some of that weight gain can be clawed back, in a follow-up commit,
that folds in the existing powersOfTen table in extfloat.go.

RELNOTE=yes

Change-Id: I3953110deaa1f5f6941e88e8417c4665b649ed80
Reviewed-on: https://go-review.googlesource.com/c/go/+/260858
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Nigel Tao <nigeltao@golang.org>
2020-10-17 00:26:52 +00:00
..
articles doc/articles/wiki: add missing log import to net/http tutorial 2020-08-16 21:51:36 +00:00
codewalk doc: convert remaining bash tests to Go 2019-11-14 21:33:00 +00:00
gopher
play doc/play: match the hello world snippet in x/website 2019-10-23 22:43:37 +00:00
progs all: replace Replace(..., -1) with ReplaceAll(...) 2020-08-17 04:07:23 +00:00
asm.html doc/asm: add BP is callee-save paragraph 2020-09-01 14:54:08 +00:00
cmd.html doc: remove extra br tags 2020-02-23 01:23:41 +00:00
contribute.html doc: fix typo in contribute.html 2020-10-06 07:37:55 +00:00
debugging_with_gdb.html doc/debugging_with_gdb: fix the link of delve 2020-04-13 04:26:57 +00:00
diagnostics.html runtime: implement GODEBUG=inittrace=1 support 2020-10-14 05:34:32 +00:00
editors.html doc/editors.html: update VS Code Go extension url 2020-07-08 13:59:06 +00:00
effective_go.html doc: add note about missing lock in sample code 2020-06-30 13:02:41 +00:00
gccgo_contribute.html all: remove trailing whitespace from HTML files 2019-09-18 18:32:20 +00:00
gccgo_install.html doc/gccgo: change gold build instructions to use Git repository 2020-06-15 19:05:29 +00:00
go1.1.html
go1.2.html
go1.3.html doc: rewrite reference to plan9.bell-labs.com to 9p.io 2019-08-19 21:42:54 +00:00
go1.4.html
go1.5.html
go1.6.html doc: align documents link 2019-08-26 17:33:52 +00:00
go1.7.html doc: align documents link 2019-08-26 17:33:52 +00:00
go1.8.html doc: align documents link 2019-08-26 17:33:52 +00:00
go1.9.html doc: rename HTML element IDs to avoid duplicates 2020-02-05 14:32:50 +00:00
go1.10.html all: avoid awkward wording from CL 236857 2020-06-08 21:36:04 +00:00
go1.11.html doc: rename HTML element IDs to avoid duplicates 2020-02-05 14:32:50 +00:00
go1.12.html doc: align documents link 2019-08-26 17:33:52 +00:00
go1.13.html doc: rename HTML element IDs to avoid duplicates 2020-02-05 14:32:50 +00:00
go1.14.html doc/go1.14: document json.Umarshal map key support of TextUnmarshaler 2020-08-27 09:47:26 +00:00
go1.15.html doc/go1.15: include behavior updates to the context package 2020-08-12 23:25:46 +00:00
go1.16.html strconv: use the Eisel-Lemire ParseFloat algorithm 2020-10-17 00:26:52 +00:00
go1.html
go1compat.html
go_faq.html doc/faq: fix a grammar mistake 2020-06-25 02:59:06 +00:00
go_mem.html doc/mem: remove unnecessary pre tags within same snippet 2020-03-03 09:28:34 +00:00
go_spec.html spec: better variable name for operator example 2020-09-24 20:41:14 +00:00
go-logo-black.png
go-logo-blue.png
go-logo-white.png
help.html doc: add alt attribute to gopher image in help.html 2020-06-29 17:59:28 +00:00
ie.css
install-source.html doc: update install docs for 387->softfloat transition 2020-10-09 02:49:19 +00:00
install.html doc: update the minimum supported macOS version to 10.11 2020-04-01 18:26:02 +00:00
share.png
tos.html