• Keith Randall's avatar
    runtime: get rid of the settype buffer and lock. · 3b5278fc
    Keith Randall authored
    MCaches	now hold a MSpan for each sizeclass which they have
    exclusive access to allocate from, so no lock is needed.
    
    Modifying the heap bitmaps also no longer requires a cas.
    
    runtime.free gets more expensive.  But we don't use it
    much any more.
    
    It's not much faster on 1 processor, but it's a lot
    faster on multiple processors.
    
    benchmark                 old ns/op    new ns/op    delta
    BenchmarkSetTypeNoPtr1           24           23   -0.42%
    BenchmarkSetTypeNoPtr2           33           34   +0.89%
    BenchmarkSetTypePtr1             51           49   -3.72%
    BenchmarkSetTypePtr2             55           54   -1.98%
    
    benchmark                old ns/op    new ns/op    delta
    BenchmarkAllocation          52739        50770   -3.73%
    BenchmarkAllocation-2        33957        34141   +0.54%
    BenchmarkAllocation-3        33326        29015  -12.94%
    BenchmarkAllocation-4        38105        25795  -32.31%
    BenchmarkAllocation-5        68055        24409  -64.13%
    BenchmarkAllocation-6        71544        23488  -67.17%
    BenchmarkAllocation-7        68374        23041  -66.30%
    BenchmarkAllocation-8        70117        20758  -70.40%
    
    LGTM=rsc, dvyukov
    R=dvyukov, bradfitz, khr, rsc
    CC=golang-codereviews
    https://golang.org/cl/46810043
    3b5278fc
gc_test.go 3.65 KB