• Dmitriy Vyukov's avatar
    runtime: implement transfer cache · e0df11d5
    Dmitriy Vyukov authored
    Currently we do the following dance after sweeping a span:
    1. lock mcentral
    2. remove the span from a list
    3. unlock mcentral
    4. unmark span
    5. lock mheap
    6. insert the span into heap
    7. unlock mheap
    8. lock mcentral
    9. observe empty list
    10. unlock mcentral
    11. lock mheap
    12. grab the span
    13. unlock mheap
    14. mark span
    15. lock mcentral
    16. insert the span into empty list
    17. unlock mcentral
    
    This change short-circuits this sequence to nothing,
    that is, we just cache and use the span after sweeping.
    
    This gives us functionality similar (even better) to tcmalloc's transfer cache.
    
    benchmark            old ns/op     new ns/op     delta
    BenchmarkMalloc8     22.2          19.5          -12.16%
    BenchmarkMalloc16    31.0          26.6          -14.19%
    
    LGTM=khr
    R=golang-codereviews, khr
    CC=golang-codereviews, rlh, rsc
    https://golang.org/cl/119550043
    e0df11d5
Name
Last commit
Last update
..
archive Loading commit data...
bufio Loading commit data...
builtin Loading commit data...
bytes Loading commit data...
compress Loading commit data...
container Loading commit data...
crypto Loading commit data...
database/sql Loading commit data...
debug Loading commit data...
encoding Loading commit data...
errors Loading commit data...
expvar Loading commit data...
flag Loading commit data...
fmt Loading commit data...
go Loading commit data...
hash Loading commit data...
html Loading commit data...
image Loading commit data...
index/suffixarray Loading commit data...
internal/syscall Loading commit data...
io Loading commit data...
log Loading commit data...
math Loading commit data...
mime Loading commit data...
net Loading commit data...
os Loading commit data...
path Loading commit data...
reflect Loading commit data...
regexp Loading commit data...
runtime Loading commit data...
sort Loading commit data...
strconv Loading commit data...
strings Loading commit data...
sync Loading commit data...
syscall Loading commit data...
testing Loading commit data...
text Loading commit data...
time Loading commit data...
unicode Loading commit data...
unsafe Loading commit data...