profiler icon indicating copy to clipboard operation
profiler copied to clipboard

Only show number of memory operations if larger than zero

Open parttimenerd opened this issue 3 years ago • 6 comments

This PR hides the number of operations in imported profiles where the number might not be valid (and replaced with -1 or 0). This is a small and tested change, as redesigning the memory track is currently out of scope (and could be better achieved by using custom marker tracks).

This PR changes

image to image

Deployment preview production

parttimenerd avatar Oct 05 '22 11:10 parttimenerd

Codecov Report

Base: 88.44% // Head: 88.44% // Increases project coverage by +0.00% :tada:

Coverage data is based on head (e587f44) compared to base (eb3c4c6). Patch coverage: 100.00% of modified lines in pull request are covered.

:exclamation: Current head e587f44 differs from pull request most recent head ecdb89f. Consider uploading reports for the commit ecdb89f to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4264   +/-   ##
=======================================
  Coverage   88.44%   88.44%           
=======================================
  Files         282      282           
  Lines       24888    24863   -25     
  Branches     6682     6668   -14     
=======================================
- Hits        22012    21991   -21     
+ Misses       2671     2667    -4     
  Partials      205      205           
Impacted Files Coverage Δ
src/app-logic/constants.js 100.00% <100.00%> (ø)
src/components/timeline/TrackMemoryGraph.js 92.30% <100.00%> (+0.04%) :arrow_up:
src/profile-logic/processed-profile-versioning.js 85.30% <100.00%> (+0.01%) :arrow_up:
src/profile-logic/profile-data.js 90.49% <100.00%> (+<0.01%) :arrow_up:
src/test/fixtures/profiles/processed-profile.js 94.51% <100.00%> (+0.02%) :arrow_up:
src/components/app/MenuButtons/MetaInfo.js 82.71% <0.00%> (-2.71%) :arrow_down:
src/components/shared/SourceView-codemirror.js 90.81% <0.00%> (-0.10%) :arrow_down:
src/components/timeline/TrackContextMenu.js 92.37% <0.00%> (-0.05%) :arrow_down:
src/components/tooltip/Marker.js 98.41% <0.00%> (-0.04%) :arrow_down:
src/profile-logic/marker-data.js 93.35% <0.00%> (-0.03%) :arrow_down:
... and 6 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Oct 05 '22 11:10 codecov[bot]

So with -1 we could argue that the profile data is incorrect...

That's the reason why I chose 0.

I wonder if we should use null in that case instead of -1 (which is a cheap hack)

null would probably not be a cheap hack, as null + null !== null, but -1 + -1 < 0 and 0 + 0 <= 0

parttimenerd avatar Oct 11 '22 17:10 parttimenerd

null would probably not be a cheap hack, as null + null !== null, but -1 + -1 < 0 and 0 + 0 <= 0

Yes, I meant that the cheap hack is using -1, but using null could be the right solution... But it's possible I didn't understand all the cases.

julienw avatar Oct 11 '22 18:10 julienw

Or we could add a flat in the meta section in the profile?

parttimenerd avatar Oct 11 '22 18:10 parttimenerd

I see other counters we use just put "0" in this information. This is really wasting space in the profile. Then now I believe it would be better to make this property optional, so that it could just be missing in the counters than don't use that. For other counters than memory, they don't use it, so that won't impact them anyway, and for the memory counter this would support your use case.

What do you think?

julienw avatar Oct 12 '22 17:10 julienw

This should be the best option long term.

parttimenerd avatar Oct 12 '22 18:10 parttimenerd

I updated my implementation accordingly.

parttimenerd avatar Oct 19 '22 13:10 parttimenerd

I think we should bump the processed format version,

The reason is that profiles without the property crash with the current production version because the existing code accesses it directly.

julienw avatar Oct 20 '22 17:10 julienw

I found that too, thanks for the review.

parttimenerd avatar Oct 20 '22 17:10 parttimenerd

hey @parttimenerd, I don't see a change about the version here, did you forget to push the changes?

julienw avatar Oct 25 '22 15:10 julienw

I forgot to bump the version, I'll do it now.

parttimenerd avatar Oct 25 '22 15:10 parttimenerd