1
0
mirror of https://github.com/golang/go synced 2024-11-08 04:46:11 -07:00
go/src/bytes
Hiroshi Ioka e10286aeda bytes: make IndexRune faster
re-implement IndexRune by IndexByte and Index which are well optimized
to get performance gain.

name                  old time/op   new time/op     delta
IndexRune/10-4         53.2ns ± 1%     29.1ns ± 1%    -45.32%  (p=0.008 n=5+5)
IndexRune/32-4          191ns ± 1%       27ns ± 1%    -85.75%  (p=0.008 n=5+5)
IndexRune/4K-4         23.5µs ± 1%      1.0µs ± 1%    -95.77%  (p=0.008 n=5+5)
IndexRune/4M-4         23.8ms ± 0%      1.0ms ± 2%    -95.90%  (p=0.008 n=5+5)
IndexRune/64M-4         384ms ± 1%       15ms ± 1%    -95.98%  (p=0.008 n=5+5)
IndexRuneASCII/10-4    61.5ns ± 0%     10.3ns ± 4%    -83.17%  (p=0.008 n=5+5)
IndexRuneASCII/32-4     203ns ± 0%       11ns ± 5%    -94.68%  (p=0.008 n=5+5)
IndexRuneASCII/4K-4    23.4µs ± 0%      0.3µs ± 2%    -98.60%  (p=0.008 n=5+5)
IndexRuneASCII/4M-4    24.0ms ± 1%      0.3ms ± 1%    -98.60%  (p=0.008 n=5+5)
IndexRuneASCII/64M-4    386ms ± 2%        6ms ± 1%    -98.57%  (p=0.008 n=5+5)

name                  old speed     new speed       delta
IndexRune/10-4        188MB/s ± 1%    344MB/s ± 1%    +82.91%  (p=0.008 n=5+5)
IndexRune/32-4        167MB/s ± 0%   1175MB/s ± 1%   +603.52%  (p=0.008 n=5+5)
IndexRune/4K-4        174MB/s ± 1%   4117MB/s ± 1%  +2262.71%  (p=0.008 n=5+5)
IndexRune/4M-4        176MB/s ± 0%   4299MB/s ± 2%  +2340.46%  (p=0.008 n=5+5)
IndexRune/64M-4       175MB/s ± 1%   4354MB/s ± 1%  +2388.57%  (p=0.008 n=5+5)
IndexRuneASCII/10-4   163MB/s ± 0%    968MB/s ± 4%   +494.66%  (p=0.008 n=5+5)
IndexRuneASCII/32-4   157MB/s ± 0%   2974MB/s ± 4%  +1788.59%  (p=0.008 n=5+5)
IndexRuneASCII/4K-4   175MB/s ± 0%  12481MB/s ± 2%  +7027.71%  (p=0.008 n=5+5)
IndexRuneASCII/4M-4   175MB/s ± 1%  12510MB/s ± 1%  +7061.15%  (p=0.008 n=5+5)
IndexRuneASCII/64M-4  174MB/s ± 2%  12143MB/s ± 1%  +6881.70%  (p=0.008 n=5+5)

Change-Id: I0632eadb83937c2a9daa7f0ce79df1dee64f992e
Reviewed-on: https://go-review.googlesource.com/28537
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-06 23:32:57 +00:00
..
buffer_test.go bytes: export Cap method for buffer 2015-04-03 23:50:02 +00:00
buffer.go bytes: correct comment about usage of bytes.Buffer by Printf 2016-03-10 15:54:08 +00:00
bytes_amd64.go bytes: make IndexRune faster 2016-09-06 23:32:57 +00:00
bytes_decl.go all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
bytes_generic.go bytes: Use the same algorithm as strings for Index 2016-09-01 18:05:50 +00:00
bytes_test.go bytes: make IndexRune faster 2016-09-06 23:32:57 +00:00
bytes.go bytes: make IndexRune faster 2016-09-06 23:32:57 +00:00
compare_test.go all: single space after period. 2016-03-02 00:13:47 +00:00
equal_test.go all: single space after period. 2016-03-02 00:13:47 +00:00
example_test.go bytes: add examples 2016-08-16 01:33:32 +00:00
export_test.go bytes: export Cap method for buffer 2015-04-03 23:50:02 +00:00
reader_test.go all: use SeekStart, SeekCurrent, SeekEnd 2016-05-06 00:10:41 +00:00
reader.go all: use SeekStart, SeekCurrent, SeekEnd 2016-05-06 00:10:41 +00:00