-
-
Notifications
You must be signed in to change notification settings - Fork 344
rangebars: don't show whiskers when not needed #5004
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
Draft
aplavin
wants to merge
1
commit into
MakieOrg:master
Choose a base branch
from
aplavin:rangebars2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
This would also mean you can't make whiskers visible after the plot call. I.e.
plot.whiskerwidth[] = 5
.Once we're done with #4630 this can be handled more efficiently with the compute graph too. Probably by just making the whisker plot invisible, because that should stop rendering from requesting this calculation to run.
Uh oh!
There was an error while loading. Please reload this page.
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.
Exactly, that's my worry that I indicated as well.
#4630 looks a bit scary in how breaking it can be for all the code using Makie + Observables :)
Still, would be great to have this optimization in Makie – now I'm forced to use my Makie fork in an app to achieve reasonable performance. For rangebars, "no whiskers" is the most common scenario given that it's the default.
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 this was always a drawback of the observables design, that you pay for the whole graph most of the time, even if parts are unused/hidden. How many rangebars were you using to notice the slowness? You could also use
linesegments
instead of keeping a fork, that should be little refactoring workThere 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.
Tens of thousands points, and the difference becomes noticeable in interactive usage.
The fork is not just for this PR, but for all my performance optimizations (see several adjacent PRs) that accumulate to 10x-100x improvement in my scenario.
Uh oh!
There was an error while loading. Please reload this page.
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.
Here, it's not really determined at any point that these calculations are not needed, so even adding "pruning" won't help by itself. Whiskers are always calculated and plotted all the way to the end, they just often (including the default) "happen" to have zero 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.
Thinking a bit more, I don't see any downside with treating
whiskerwidth < 0
as "I don't really need whiskers, and won't update whiskerwidth for this plot". This can even remain undocumented, just with a comment in the code to explain the condition.Is anyone against it? Otherwise I can update this PR correspondingly.
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 agree with that, I've tried hard to make as many things in Makie updateable as possible, and regard the places where it's not possible as "design warts". But if the compute graph helps to shut down specific branches if some conditions hold, that would be a very good way of dealing with this.
What could be done before that is to avoid the calculation of the whiskers if their width is zero, for example make all coordinates NaN or some constants. It wouldn't matter that they are in the wrong spot as long as they are not visible anyway.
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 #4630 rendering pulls data in. If a primitive plot is not visible, the backend won't bother to pull. So if this stuff gets translated setting the whisker plot to
visible = false
is equivalent to never triggering thislift
. Well, probably once on initialization in W/GLMakie and really never in CairoMakie.Btw another way you can probably drastically cut the cost of this is to use something like
scatter(errorbar_endpoints, marker = Rect, markersize = Vec2f(whiskerwidth, whiskerlinewidth))
. That should help with the whisker-visible case tooUh oh!
There was an error while loading. Please reload this page.
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 would take "no overhead" over "internal design warts" any time, whenever something is performance-sensitive – which it often is for interactive plots :)
It's just unfortunate than one has to depend on my Makie fork for these optimizations, meaning that everyone else using rangebars experience this huge overhead from something they don't need nor use.
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.
well, we do want to merge the compute graph pretty soon, so I guess we might just wait for that before introducing such a workaround?