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

Compute rect position and width from samples #210

Merged
merged 5 commits into from May 5, 2021

Conversation

saethlin
Copy link
Contributor

This is my attempt at implementing a solution for #207. Recomputing the percentage position and width every time from the integer sample counts should keep floating-point errors to a minimum. Just that change altered the matched % reported during a search.

But I think the bigger discrepancy was coming from the regex search selecting samples that weren't on screen at all. Since I added the check for hidden objects everything seems quite reasonable.

I'm making this PR because a few days ago I zoomed way in to see the dashmap spinlock loop and the rectangles were hanging over each other. I don't have a reproducer of this on hand to verify, but boy does that seem like floating-point imprecision to me.

Copy link
Owner

@jonhoo jonhoo left a comment

Choose a reason for hiding this comment

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

This is a great change, thank you for taking the time to go through it! I left some comments inline, but in general the approach looks great.

src/flamegraph/flamegraph.js Outdated Show resolved Hide resolved
src/flamegraph/flamegraph.js Outdated Show resolved Hide resolved
src/flamegraph/flamegraph.js Outdated Show resolved Hide resolved
src/flamegraph/mod.rs Outdated Show resolved Hide resolved
src/flamegraph/flamegraph.js Outdated Show resolved Hide resolved
@saethlin
Copy link
Contributor Author

I just realized that I've broken this code, which attempts to access _orig_x: https://github.com/jonhoo/inferno/pull/210/files#diff-57033a9a1ddd2ffa82ff282a58541526d380285fdebecc47fca185ef5414798dR75-R80

Unfortunately I have no idea what it's for. I can't find any functionality that's missing. Help?

@jonhoo
Copy link
Owner

jonhoo commented May 2, 2021

Looks like GitHub got confused about your link. I think you're referring to

if (el && el.attributes && el.attributes.y && el.attributes._orig_x) {
var params = get_params()
params.x = el.attributes._orig_x.value;
params.y = el.attributes.y.value;
history.replaceState(null, null, parse_params(params));
}

My read of that code is that it checks that the clicked rectangle is actually a sample box, and not just some other random rect on the page. It uses the check that _orig_x is set as a proxy for that. And the preceeding checks are just to avoid errors if it lands on a rect that, say, doesn't have any attributes. You could probably just check for fg:x instead there.

@codecov
Copy link

codecov bot commented May 2, 2021

Codecov Report

Merging #210 (675c79c) into master (8fd0289) will decrease coverage by 0.59%.
The diff coverage is 77.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #210      +/-   ##
==========================================
- Coverage   90.08%   89.48%   -0.60%     
==========================================
  Files          17       17              
  Lines        2239     2312      +73     
==========================================
+ Hits         2017     2069      +52     
- Misses        222      243      +21     
Impacted Files Coverage Δ
src/collapse/mod.rs 52.63% <0.00%> (-14.04%) ⬇️
src/collapse/common.rs 59.66% <50.00%> (-0.61%) ⬇️
src/collapse/guess.rs 69.23% <100.00%> (-8.82%) ⬇️
src/collapse/matcher.rs 100.00% <100.00%> (ø)
src/collapse/perf.rs 95.45% <100.00%> (-1.91%) ⬇️
src/flamegraph/color/mod.rs 83.87% <100.00%> (-0.11%) ⬇️
src/flamegraph/color/palettes.rs 99.31% <100.00%> (-0.23%) ⬇️
src/flamegraph/mod.rs 97.60% <100.00%> (+1.14%) ⬆️
src/flamegraph/svg.rs 97.69% <100.00%> (-0.07%) ⬇️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 43ed780...675c79c. Read the comment docs.

Copy link
Owner

@jonhoo jonhoo left a comment

Choose a reason for hiding this comment

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

Will release this either today or tomorrow, thanks! 👍

@jonhoo jonhoo merged commit d80e579 into jonhoo:master May 5, 2021
@jonhoo
Copy link
Owner

jonhoo commented May 5, 2021

Released in 0.10.4

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