Skip to content

Commit

Permalink
dwarf/reader: precalcStack does not need to read past the first entry
Browse files Browse the repository at this point in the history
It was reading all the way to the end of the debug_info section,
slowing down stacktraces substantially.

Benchmark before:

BenchmarkConditionalBreakpoints-4   	       1	80344642562 ns/op

Benchmark after:

BenchmarkConditionalBreakpoints-4   	       1	22218288218 ns/op

i.e. a reduction of the cost of a breakpoint hit from 8ms to 2.2ms

Updates go-delve#1549
  • Loading branch information
aarzilli committed Jan 23, 2020
1 parent 226eb2b commit 1b04ce4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/dwarf/reader/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,9 @@ childLoop:
default:
irdr.reader.SkipChildren()
}
if rentry == nil {
break
}
}

if rentry != nil && rentry.Tag == dwarf.TagInlinedSubroutine {
Expand Down

0 comments on commit 1b04ce4

Please sign in to comment.