-
Notifications
You must be signed in to change notification settings - Fork 602
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
Synchronizer plugin - selectClosest option #1035
base: master
Are you sure you want to change the base?
Conversation
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.
Switched to use layout_.points instead of graph.getValue() for closest point search. Tested on two synchronized graphs (of 1000 and 100 rows resp) with 1mil iterations, got about 50% performance improvement when unzoomed and more if zoomed in
Also filtered when the found point is out of graph view. This should be done for crosshair plugin too, I'll open separate pr for it |
n-gist dixit:
got about 50% performance improvement
Sweet!
Also filtered when the found point is out of graph view. This should be
done for crosshair plugin too, I'll open separate pr for it
OK, thanks!
I don’t have the bandwidth to look at it currently (was ill for over two
weeks and have to catch up on missed things now) but I’ll look at them
eventually.
|
I’ll look at them eventually
Sure, take your time. Please check #1037 for possible reopening.
Get better!
|
When searching for closest point on synced graphs, x axis values are compared. Fine for default graphs, but for those which are in For example, selecting This can be done as a separate option, but it seems logical to make it the default |
Adding small fix for stepPlot mode graphs. If synchronizing graph has exact x axis value, return it, even if it is ending point of a step period |
Adds
selectClosest
option to synchronizer plugin so it selects values closest to desired. Defaults to false.It can be helpful when graphs have not identical x axes data. (For example, when a graph has only one of each n values of another, or the values are different, but are close visually)
As the added search method
closestIdx()
is a bit slower (about 3 time slower thangetRowForX()
), I have added some optimization logic:If the option is turned on, it checks graphs rows lengths first. If they are equal, it assumes that axes have identical values and thus tries to use
getRowForX()
. Otherwise, or if the value was not found, it uses newclosestIdx()
search function (uses binary search algorithm).