• Rémy Oudompheng's avatar
    cmd/gc: apply escape analysis results to closures. · 9fe60801
    Rémy Oudompheng authored
    This avoids an allocation when closures are used
    as "macros", in Walk idioms, or as argument to defer.
    
    benchmark                old ns/op    new ns/op    delta
    BenchmarkSearchWrappers       1171          354  -69.77%
    BenchmarkCallClosure             3            3  -12.54%
    BenchmarkCallClosure1          119            7  -93.95%
    BenchmarkCallClosure2          183           74  -59.18%
    BenchmarkCallClosure3          187           75  -59.57%
    BenchmarkCallClosure4          187           76  -58.98%
    
    Compared to Go 1:
    benchmark                  old ns/op    new ns/op    delta
    BenchmarkSearchWrappers         3208          354  -88.97%
    
    Fixes #3520.
    
    R=daniel.morsing, bradfitz, minux.ma, dave, rsc
    CC=golang-dev
    https://golang.org/cl/7397056
    9fe60801
search_test.go 4.1 KB