-
Notifications
You must be signed in to change notification settings - Fork 490
perf(stacktrace): optimize parseSymbol with zero-allocation implementation #4148
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
perf(stacktrace): optimize parseSymbol with zero-allocation implementation #4148
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
BenchmarksBenchmark execution time: 2025-11-25 14:32:14 Comparing candidate commit 2e0365e in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 18 metrics, 0 unstable metrics. |
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🔗 Commit SHA: 2e0365e | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
e673b82 to
19fa72c
Compare
9865787 to
1ed7e54
Compare
fe173f5 to
89e0450
Compare
Interesting |
This is because we haven't had that benchmark in the main before. Great catch! |
…tation
Replace regex-based symbol parsing with string operations to eliminate
per-frame allocations in stack capture.
Performance improvements:
- parseSymbol: 0 allocs/op (was ~2 allocs/op)
- BenchmarkCaptureWithRedaction/depth_10: 38→6 allocs/op (84% reduction)
- BenchmarkCaptureWithRedaction/depth_50: 118→6 allocs/op (95% reduction)
- Speed: 19.2µs→4.1µs @ depth=10 (79% faster)
- Memory: 8966B→5296B @ depth=10 (41% reduction)
Allocations are now constant regardless of stack depth.
Signed-off-by: Kemal Akkoyun <[email protected]>
89e0450 to
0cbb439
Compare
|
|
@kakkoyun Actually I was not thinking about this but about the other benchmarks in the package that should still be impacted by this. all the better if you separated this benchmark |
We don't have this method called in any of the other benchmarks, AFAICT. |
darccio
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like when we drop regexps 😁 LGTM. I assume this is covered by the current tests.
|
/merge |
|
View all feedbacks in Devflow UI.
This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
The expected merge time in
|
cc @eliottness |

What does this PR do?
Replace regex-based symbol parsing with string operations to eliminate
per-frame allocations in stack capture.
Motivation
Improve the performance and reduce the allocations.
Reviewer's Checklist
./scripts/lint.shlocally.Unsure? Have a question? Request a review!