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
Heap size UI #718
Heap size UI #718
Changes from 5 commits
45be3d7
eda96ae
4946213
4a759dc
7d214ea
b0c7344
38d1c93
ac6f7a4
47d2717
d755970
be6a953
8c61c9b
ec7d211
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Since you're clearing the info if this condition is false, you should check the condition before making the network request. No need to make the request if you know the data will be discarded
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.
The usage is not discarded though, it's passed as a attribute to the setState call later. I moved the setState call to the top to be more clear.
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.
What is the
* 1.5
for here?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.
It's just a buffer in the historyUsage array so that the graph produced isn't cut short at the beginning
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.
It probably won't make much of a difference here, but it would possibly be more efficient to do something like this. I'm assuming in most cases you would be shifting just 1 element off at a time, so it's probably negligible
slice is slower than shift, but where this would shine is if you were often removing many elements at once. Even if shift is a faster operation, you could be doing 50 shifts instead of just 1 slice which would make the 1 slower slice faster overall
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.
Yeah, so the most shifting we'll do is 3 at a time, that happens when the user 'unhovers' over the usage info.
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.
Should this still happen if background monitoring is disabled?
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.
Yes, the background monitoring is only for the graph.
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.
It looks like there's a case where you don't want to set the interval if there's no background monitoring
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.
background monitoring is only for the graph, i.e., the historyUsage array. The memory usage data still needs to be updated at regular intervals regardless of bgmonitoring
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.
Why are you trimming to 2 decimal places here and then using
toFixed
later? Is it because thetoFixed
doesn't round properly?You could instead use a number formatter which is built in now. See MDN and stack overflow example
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.
So the
toDecimalPlace()
rounds the values to two decimal places, but it doesn't guarantee that the result has 2 decimal places when printed. For example,toDecimalPlace(1.9999, 2) => 2
. Which is why I need thetoFixed()
to force the values to have two decimal places, filling in with 0s if needed. I need this two step process because I want to guaranteeinUseGB + freeMemoryGB = totalHeapGB
. Previously, the value may be off by 0.01 GB.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.
@dsmmcken Do we have Sass stuff for the font weight? Should we be using
fontWeight: 'bold'
or a numeric value instead?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.
Why the empty style?
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'm not sure if this should be a
h6
tag as well. While our app isn't the best from an accessibility standpoint (and we don't enforce accessibility things), it is not great to put the same tag for different levels of importance in the dom. Visually it's fine, but semantically it's probably wrong.Is the styling of h6 even different from a normal div or span?
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.
Now I wonder if 10 minutes is too long, graph moves so slow. Maybe 5?
Thoughts?
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.
Windows task manager shows performance over 60s, so maybe we move to 5 minutes and double the poll rate?