Skip to content

[ENHANCEMENT] pyroscope: optimize transformProfileResponse to O(n)#747

Open
luweglarz wants to merge 1 commit into
perses:mainfrom
luweglarz:pyroscope-profile-transform-perf
Open

[ENHANCEMENT] pyroscope: optimize transformProfileResponse to O(n)#747
luweglarz wants to merge 1 commit into
perses:mainfrom
luweglarz:pyroscope-profile-transform-perf

Conversation

@luweglarz

@luweglarz luweglarz commented Jul 22, 2026

Copy link
Copy Markdown

Description

There was an explicit todo on this function to optimize from O(n2) to O(n).

The old code rescanned the whole parent level from scratch for every node. Since both levels are already sorted by start, a single pointer that only moves forward is enough in one pass.

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.

@luweglarz
luweglarz requested a review from a team as a code owner July 22, 2026 14:20
@luweglarz
luweglarz requested review from jgbernalp and removed request for a team July 22, 2026 14:20

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be good to add a test for this, so we can ensure it does not affect the output.

@luweglarz
luweglarz force-pushed the pyroscope-profile-transform-perf branch from c42604b to d436c72 Compare July 24, 2026 13:11
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.

2 participants