-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
add Profiler.increment and Profiler.frame #2196
Conversation
036a919
to
2da1c20
Compare
if (blockCached._profiler !== runtime.profiler) { | ||
prepareBlockProfiling(runtime.profiler, blockCached); | ||
} | ||
const end = Math.min(i + 1, 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.
Can you add a comment about what this calculation is? It's difficult to keep track of units and what i
and length
correspond to.
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.
Added.
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.
// Determine the index that is after the last executed block. `i` is
// currently the block that was just executed. `i + 1` will be the block
// after that. `length` with the min call makes sure we don't try to
// reference an operation outside of the set of operations.
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.
A few questions and minor changes requested inline.
30b8806
to
081b6b4
Compare
|
Let profiled code track frames and arguments called by incrementing a counter for a frame id or frame id and argument. This replaces the same counting by recording the call as part of a history of calls and returns. Updating the array for all calls counted takes enough time to bias the profiled run towards less overall executions.
081b6b4
to
d3ae002
Compare
Resolves
Scratch performance when the profiler is recording.
Proposed Changes
Let profiled code track frames and arguments called by incrementing a counter for a frame id or frame id and argument. This replaces the same counting by recording the call as part of a history of calls and returns. Updating the array for all calls counted takes enough time to bias the profiled run towards less overall executions.
Reason for Changes
Scratch performance has improved to the point again that we need to change how the Profiler records performance to spend more time executing blocks than spending time recording that a block executed.
Benchmark Data
These numbers indicate a large improvement. Take note this improvement is only affecting when profiling is recording. This is a scratch developer facing improvement so we can get a better measure a change will make while developing the change and reviewing the change.