Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delayed symbol decoding #65

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

a-palchikov
Copy link
Contributor

@a-palchikov a-palchikov commented Apr 12, 2021

This PR implements delayed decoding of debug symbols to lower the memory allocations and speed up error value creation in the basic wrapping scenario. The symbols are decoded when necessary (e.g. on DebugReport or upon being written to the wire).

Before the change

$ go test -bench=. -benchmem ./...
OK: 29 passed
goos: linux
goarch: amd64
pkg: github.com/gravitational/trace
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
BenchmarkStacktraceAllocs-16    	  642918	      1574 ns/op	     779 B/op	       6 allocs/op

After the change:

$ go test -bench=. -benchmem ./...
OK: 29 passed
goos: linux
goarch: amd64
pkg: github.com/gravitational/trace
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
BenchmarkStacktraceAllocs-16    	 1348497	       829.1 ns/op	     400 B/op	       4 allocs/op
$ benchstat old.txt new.txt 
name                 old time/op    new time/op    delta
StacktraceAllocs-16    1.57µs ± 0%    0.83µs ± 0%   ~     (p=1.000 n=1+1)

name                 old alloc/op   new alloc/op   delta
StacktraceAllocs-16      779B ± 0%      400B ± 0%   ~     (p=1.000 n=1+1)

name                 old allocs/op  new allocs/op  delta
StacktraceAllocs-16      6.00 ± 0%      4.00 ± 0%   ~     (p=1.000 n=1+1)

@a-palchikov a-palchikov force-pushed the dmitri/delayed-symbol-decoding branch from 80ab5c3 to 4e6421a Compare April 12, 2021 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant