Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 Trace Statistics view calculation #1941
Speed up Trace Statistics view calculation #1941
Changes from 4 commits
046da80
15b77b1
0a19fee
6f7cf46
2f2d0b9
8d3593d
ba8fde9
0074d0f
d2943f3
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 don't think we can change the logic away from
*10
. DRange does not work correctly on the raw timestamps (see the comments above).Side note: we need a test that illustrates that.
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 don't understand why the calculations need to change - the speed-up is coming from building a map once instead of n^2 looping, so why not change just that part and leave the calculations intact?
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.
In the change we use
DRange(begin, end - 1)
to represent halp-open intervals. The length of this DRange is(end-1)-begin+1=end-begin
because DRange treats all intervals as inclusive.In the example above
(1, 10)
will be represented asDRange(1, 9)
;(4, 8)
will be represented asDRange(4, 7)
. Sofirst.substract(second)
will berange([1..3], [8..9])
(length = 3+2=5
).As I understand there is a mistake in the comment in the calculation of
Drange.length
.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.
That still doesn't answer my question why calculations need to change, it a PR that is about efficiency of the code.
If you want to dig down to the exact reasons for *10 logic, you can see the comment as well as the discussion on the original PR that introduced it. TLDR is that DRange does not understand open/close intervals, and subtraction works incorrectly for our purposes.
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.
Agree. It shouldn't be changed in this PR. Returned to the initial version.