Skip to content

add parallel processing to PlotSignal()#72

Merged
swharden merged 8 commits intoScottPlot:masterfrom
StendProg:ParallelForSignal
Aug 10, 2019
Merged

add parallel processing to PlotSignal()#72
swharden merged 8 commits intoScottPlot:masterfrom
StendProg:ParallelForSignal

Conversation

@StendProg
Copy link
Contributor

Added RenderHighDensityParallel method to SignalPlot class.
Improve rendering speed for large signals.
Using parallel may slow render for small signals,
also may have some multithreading problems then updating signal, need lots of tests before accepted.
For PlotSignalConst gives nothing after fullLoad, i can't load cpu more then 25% with 60M signal.
This pull request more for testing, feel free to reject it.

StendProg and others added 4 commits August 7, 2019 19:45
Little optimization, but gives ability to use Parallel.For loop
added button with Parallel calculation for testing
@swharden
Copy link
Member

swharden commented Aug 8, 2019

This is excellent! A great performance increase.

Eventually there will be more parts of ScottPlot which may benefit from parallel processing. I added a useParallel bool to the Plottable class. Rather than add "useParallel" as an argument to every plottable, I made it so you can turn parallel processing on (for all plottables) with:

plt.Parallel(true);

What do you think of this solution? I agree this could use more testing, but since parallel processing is off by default I feel good about merging this with the master branch.

@swharden swharden changed the title PlotSignal Parallel.For calculation add parallel processing to PlotSignal() Aug 8, 2019
@StendProg
Copy link
Contributor Author

StendProg commented Aug 10, 2019

Parallel.For works good on heavy loops with time computation say starting from seconds and gives nothing for milliseconds loops(Parallel.For overhead). Whole library fast enouth and get milliseconds for computations. One place is big signals then you get long min/max calculations, and its closed by SignalConst class. Log2(n) time insted of linear (n) time computation. It faster in most cases even if you make linear time ( n / (threadcount) ) with Parallel.For.
I see one good place for parallel loop is iterarion over multiple plot then render. Just need get Graphics ( its not thread safe) outside loop. This would be not easy task for all plottable classes. And i think its will give nothing in most cases because bottleneck is Graphics.

@swharden swharden merged commit 7bbc23b into ScottPlot:master Aug 10, 2019
@swharden
Copy link
Member

@StendProg StendProg deleted the ParallelForSignal branch August 10, 2019 18:46
StendProg pushed a commit to StendProg/ScottPlot that referenced this pull request Mar 16, 2020
add parallel processing to PlotSignal()
swharden added a commit that referenced this pull request May 22, 2020
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.

2 participants