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

Speed up Critical path calculation #1975

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

maxgaponov
Copy link
Contributor

@maxgaponov maxgaponov commented Nov 13, 2023

Which problem is this PR solving?

Description of the changes

  • Rewrote computeCriticalPath function to make less recursive calls

How was this change tested?

  • Existing tests

Checklist

Signed-off-by: Maksim Gaponov <gaponovmaxev@gmail.com>
@maxgaponov maxgaponov requested a review from a team as a code owner November 13, 2023 17:56
@maxgaponov maxgaponov requested review from albertteoh and removed request for a team November 13, 2023 17:56
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

I recommend writing down the algorithm in words, to understand what you're trying to change. So far it does not seem equivalent to me.

): criticalPathSection[] => {
const currentSpan: Span = spanMap.get(spanId)!;
let criticalPathBoundary = currentSpan.startTime + currentSpan.duration;
Copy link
Member

Choose a reason for hiding this comment

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

confusing name, boundary can be either top or bottom

spanId: currentSpan.spanID,
section_start: childEndTime,
section_end: criticalPathBoundary,
};
Copy link
Member

Choose a reason for hiding this comment

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

I don't follow. criticalPathBoundary is initially end-of-parent. This says if the child ends before than, then the difference between child.end and parent.end is the critical path contributed by that span?

reference => reference.refType === 'CHILD_OF'
)[0].spanID;
computeCriticalPath(spanMap, parentSpanId, criticalPath, currentSpan.startTime);
for (let i = 0; i < currentSpan.childSpanIds.length; i++) {
Copy link
Member

Choose a reason for hiding this comment

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

is there an assumption on the order of this array?

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.

None yet

2 participants