]> Cypherpunks repositories - gostls13.git/commit
cmd/gc: apply escape analysis results to closures.
authorRémy Oudompheng <oudomphe@phare.normalesup.org>
Mon, 25 Feb 2013 23:40:28 +0000 (00:40 +0100)
committerRémy Oudompheng <oudomphe@phare.normalesup.org>
Mon, 25 Feb 2013 23:40:28 +0000 (00:40 +0100)
commit9fe60801aeca801010b42e1dd7ad57a173dc9740
tree2e8ab5b6525f5d52448e8f7db12d3f6ccbfe1c75
parent4692711d7f172ab69a9576ffbe753314755f780a
cmd/gc: apply escape analysis results to closures.

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
src/cmd/gc/closure.c
src/pkg/sort/search_test.go