• Josh Bleecher Snyder's avatar
    runtime: change map iteration randomization to use intra-bucket offset · 3be4d957
    Josh Bleecher Snyder authored
    Map iteration previously started from a random bucket, but walked each
    bucket from the beginning. Now, iteration always starts from the first
    bucket and walks each bucket starting at a random offset. For
    performance, the random offset is selected at the start of iteration
    and reused for each bucket.
    
    Iteration over a map with 8 or fewer elements--a single bucket--will
    now be non-deterministic. There will now be only 8 different possible
    map iterations.
    
    Significant benchmark changes, on my OS X laptop (rough but consistent):
    
    benchmark                              old ns/op     new ns/op     delta
    BenchmarkMapIter                       128           121           -5.47%
    BenchmarkMapIterEmpty                  4.26          4.45          +4.46%
    BenchmarkNewEmptyMap                   114           111           -2.63%
    
    Fixes #6719.
    
    R=khr, bradfitz
    CC=golang-codereviews
    https://golang.org/cl/47370043
    3be4d957
Name
Last commit
Last update
..
5a Loading commit data...
5c Loading commit data...
5g Loading commit data...
5l Loading commit data...
6a Loading commit data...
6c Loading commit data...
6g Loading commit data...
6l Loading commit data...
8a Loading commit data...
8c Loading commit data...
8g Loading commit data...
8l Loading commit data...
addr2line Loading commit data...
api Loading commit data...
cc Loading commit data...
cgo Loading commit data...
dist Loading commit data...
fix Loading commit data...
gc Loading commit data...
go Loading commit data...
gofmt Loading commit data...
ld Loading commit data...
link Loading commit data...
nm Loading commit data...
objdump Loading commit data...
pack Loading commit data...
prof Loading commit data...
yacc Loading commit data...