diff options
| author | Dave Cheney <dave@cheney.net> | 2015-09-12 00:10:42 +1000 |
|---|---|---|
| committer | Dave Cheney <dave@cheney.net> | 2015-09-12 02:55:38 +0000 |
| commit | ea4e321d4daef32f4cd8df8ec799122ff3c6b9f0 (patch) | |
| tree | e224e2c91c0a61c9293ca6a00d8e8bbb3998542f /src/database/sql | |
| parent | 3b0224282cf84228d6bcd4b783eb164e579fbd9e (diff) | |
| download | go-ea4e321d4daef32f4cd8df8ec799122ff3c6b9f0.tar.xz | |
cmd/compile/internal/gc: avoid allocation in bnum
Although bnum was being called with a Bits value, a limitation
of the escape analyser (golang/go#12588) meant that taking the
address of the Bits.b array in the range statement caused the
formal parameter to escape to the heap.
Passing the a pointer to a Bits, as with all the other Bits helper
methods avoids the allocation.
Before:
BenchmarkBnum1-4 20000000 69.6 ns/op 32 B/op 1 allocs/op
After:
BenchmarkBnum1-4 100000000 10.1 ns/op 0 B/op 0 allocs/op
Change-Id: I673bd57ddc032ee67d09474156d795fb1ba72018
Reviewed-on: https://go-review.googlesource.com/14501
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/database/sql')
0 files changed, 0 insertions, 0 deletions
