Skip to content

Conversation

@kakkoyun
Copy link
Member

@kakkoyun kakkoyun commented Nov 20, 2025

  • refactor(stacktrace): remove unnecessary locking from segmentPrefixTrie

replaces #4149

What does this PR do?

The segmentPrefixTrie follows a write-once-read-many pattern where all
writes occur during package initialization before any concurrent access.

After initialization, the trie is effectively immutable and can be safely
read by multiple goroutines without synchronization overhead.

Something I have overlooked when I working on this initially.

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running ./scripts/lint.sh locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@kakkoyun kakkoyun changed the title kakkoyun/11 20 stacktrace optimize parsesymbol with zero allocation implementation chore(stacktrace): optimize parsesymbol with zero allocation implementation Nov 20, 2025
@kakkoyun kakkoyun changed the base branch from main to kakkoyun/11-20-docs-document_testunit_make_target November 20, 2025 14:02
@kakkoyun kakkoyun changed the title chore(stacktrace): optimize parsesymbol with zero allocation implementation refactor(stacktrace): remove unnecessary locking from segmentPrefixTrie Nov 20, 2025
@pr-commenter
Copy link

pr-commenter bot commented Nov 20, 2025

Benchmarks

Benchmark execution time: 2025-11-25 13:22:32

Comparing candidate commit 4ee937d in PR branch kakkoyun/11-20-stacktrace-optimize_parsesymbol_with_zero_allocation_implementation with baseline commit 16b7d39 in branch main.

Found 5 performance improvements and 0 performance regressions! Performance is the same for 10 metrics, 0 unstable metrics.

scenario:BenchmarkCaptureStackTrace/10-25

  • 🟩 execution_time [-280.114ns; -258.686ns] or [-2.456%; -2.268%]

scenario:BenchmarkCaptureStackTrace/100-25

  • 🟩 execution_time [-1.440µs; -1.384µs] or [-3.565%; -3.427%]

scenario:BenchmarkCaptureStackTrace/20-25

  • 🟩 execution_time [-401.335ns; -378.665ns] or [-2.722%; -2.568%]

scenario:BenchmarkCaptureStackTrace/200-25

  • 🟩 execution_time [-3.009µs; -2.848µs] or [-4.160%; -3.938%]

scenario:BenchmarkCaptureStackTrace/50-25

  • 🟩 execution_time [-721.999ns; -669.601ns] or [-2.942%; -2.728%]

@kakkoyun kakkoyun marked this pull request as ready for review November 20, 2025 14:09
@kakkoyun kakkoyun requested a review from a team as a code owner November 20, 2025 14:09
@kakkoyun kakkoyun requested a review from eliottness November 24, 2025 15:23
Copy link
Contributor

@eliottness eliottness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working implem. Feel free to ignore comments if you don't feel like it

@kakkoyun
Copy link
Member Author

Working implem. Feel free to ignore comments if you don't feel like it

Which comments? 😅

@kakkoyun kakkoyun force-pushed the kakkoyun/11-20-docs-document_testunit_make_target branch from 89e0450 to 0cbb439 Compare November 24, 2025 15:51
@kakkoyun kakkoyun changed the base branch from kakkoyun/11-20-docs-document_testunit_make_target to kakkoyun/use_stacktrace_package November 24, 2025 16:07
    The segmentPrefixTrie follows a write-once-read-many pattern where all
    writes occur during package initialization before any concurrent access.

    After initialization, the trie is effectively immutable and can be safely
    read by multiple goroutines without synchronization overhead.

Signed-off-by: Kemal Akkoyun <[email protected]>
@kakkoyun kakkoyun force-pushed the kakkoyun/11-20-stacktrace-optimize_parsesymbol_with_zero_allocation_implementation branch from bf07665 to 738be05 Compare November 24, 2025 16:14
Copy link
Member

@darccio darccio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Merge main to fix the broken system-tests, as it seems that GHA cache was flaky.

Base automatically changed from kakkoyun/use_stacktrace_package to main November 25, 2025 11:54
@kakkoyun
Copy link
Member Author

/merge

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Nov 25, 2025

View all feedbacks in Devflow UI.

2025-11-25 11:58:57 UTC ℹ️ Start processing command /merge


2025-11-25 11:59:07 UTC ℹ️ MergeQueue: waiting for PR to be ready

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.
It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2025-11-25 13:02:44 UTC ⚠️ MergeQueue: This merge request was unqueued

[email protected] unqueued this merge request

@kakkoyun
Copy link
Member Author

/remove

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Nov 25, 2025

View all feedbacks in Devflow UI.

2025-11-25 13:02:37 UTC ℹ️ Start processing command /remove


2025-11-25 13:02:41 UTC ℹ️ Devflow: /remove

@kakkoyun
Copy link
Member Author

/merge

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Nov 25, 2025

View all feedbacks in Devflow UI.

2025-11-25 13:32:59 UTC ℹ️ Start processing command /merge


2025-11-25 13:33:04 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 42m (p90).


2025-11-25 13:49:05 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue dd-mergequeue bot merged commit fa7d051 into main Nov 25, 2025
246 checks passed
@dd-mergequeue dd-mergequeue bot deleted the kakkoyun/11-20-stacktrace-optimize_parsesymbol_with_zero_allocation_implementation branch November 25, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants