• Dave Cheney's avatar
    cmd/compile/internal/gc: avoid allocation in bnum · ea4e321d
    Dave Cheney authored
    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/14501Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    ea4e321d
Name
Last commit
Last update
..
addr2line Loading commit data...
api Loading commit data...
asm Loading commit data...
cgo Loading commit data...
compile Loading commit data...
cover Loading commit data...
dist Loading commit data...
doc Loading commit data...
fix Loading commit data...
go Loading commit data...
gofmt Loading commit data...
internal Loading commit data...
link Loading commit data...
newlink Loading commit data...
nm Loading commit data...
objdump Loading commit data...
pack Loading commit data...
pprof Loading commit data...
trace Loading commit data...
vendor Loading commit data...
vet Loading commit data...
yacc Loading commit data...