]> Cypherpunks repositories - gostls13.git/commit
reflect: cache call frames
authorDmitry Vyukov <dvyukov@google.com>
Mon, 22 Dec 2014 19:31:55 +0000 (22:31 +0300)
committerDmitry Vyukov <dvyukov@google.com>
Wed, 28 Jan 2015 08:40:26 +0000 (08:40 +0000)
commit67f8a8131648346f6bf9b525cd989bd2f7293b3f
treedd675951094ea079abcad956bd92fcbf1406f44f
parentbed884e8b9ff1657fbd4f8f52d0c7a18b6445e00
reflect: cache call frames

Call frame allocations can account for significant portion
of all allocations in a program, if call is executed
in an inner loop (e.g. to process every line in a log).
On the other hand, the allocation is easy to remove
using sync.Pool since the allocation is strictly scoped.

benchmark           old ns/op     new ns/op     delta
BenchmarkCall       634           338           -46.69%
BenchmarkCall-4     496           167           -66.33%

benchmark           old allocs     new allocs     delta
BenchmarkCall       1              0              -100.00%
BenchmarkCall-4     1              0              -100.00%

Update #7818

Change-Id: Icf60cce0a9be82e6171f0c0bd80dee2393db54a7
Reviewed-on: https://go-review.googlesource.com/1954
Reviewed-by: Keith Randall <khr@golang.org>
src/reflect/all_test.go
src/reflect/export_test.go
src/reflect/makefunc.go
src/reflect/type.go
src/reflect/value.go
src/runtime/stubs.go