diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2014-12-22 22:31:55 +0300 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2015-01-28 08:40:26 +0000 |
| commit | 67f8a8131648346f6bf9b525cd989bd2f7293b3f (patch) | |
| tree | dd675951094ea079abcad956bd92fcbf1406f44f /src/runtime | |
| parent | bed884e8b9ff1657fbd4f8f52d0c7a18b6445e00 (diff) | |
| download | go-67f8a8131648346f6bf9b525cd989bd2f7293b3f.tar.xz | |
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>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/stubs.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go index d198f02e60..9aa83ef587 100644 --- a/src/runtime/stubs.go +++ b/src/runtime/stubs.go @@ -61,6 +61,11 @@ func badsystemstack() { //go:noescape func memclr(ptr unsafe.Pointer, n uintptr) +//go:linkname reflect_memclr reflect.memclr +func reflect_memclr(ptr unsafe.Pointer, n uintptr) { + memclr(ptr, n) +} + // memmove copies n bytes from "from" to "to". // in memmove_*.s //go:noescape |
