Probable candidate: search old threads on Cairo/Winston being slow. See the fix here: https://github.com/nolta/Winston.jl/blob/master/src/renderer.jl#L238- L244
You might need to do something similar. --Tim On Thursday, March 06, 2014 03:17:35 AM Roger Herikstad wrote: > Hi, > > On Thursday, March 6, 2014 5:01:58 PM UTC+8, Andreas Lobinger wrote: > > Hello colleague, > > > > hopefully we do not have a race condition here, yesterday in the late > > afternoon i ussed a PR for Cairo.jl and i included the push/pop there ( > > https://github.com/JuliaLang/Cairo.jl/pull/65) > > The changes you made here, defining the push/pull_group were exactly the > same that I was going to make : ) I took a look at your code and made some > comments, but mostly it seems very similar to what I had in mind. > > > The test_speed.jl does some rendering of dots in different methods, > > however on my box ddots4 (with push/pop group) is awfully slow. If you > > find > > time, could you review my code if i do it right, please? > > I see you are testing up to 100000 points; for my tests, I only did 10000, > since that is the usage case I'm interested in. Perhaps Cairo is not the > best solution for that many points? I have done similar scatter plotting > with OpenGL in the past and it basically handled anything I could through > at it. That's a very different approach, though, without (easy access to) > niceties such as anti-aliasing, and of course without vectorized graphics. > > > Wishing a happy day, > > > > Andreas > > > > On Thursday, March 6, 2014 9:50:43 AM UTC+1, Roger Herikstad wrote: > >> Hi, > >> I tried to modify the scatter plot code in Winston to make use of the > >> push_group/pop_group code, but for some reason I couldn't get it to work. > >> Instead, I ended combining the advice from Andreas Lobinger above with > >> the > >> fix already used in the curve(..) function to break up long paths. It > >> gives > >> me a decent speedup that is good enough for most of my use. If my > >> solution > >> seems OK to people, I can issue a pull request. > >> > >> > >> https://github.com/grero/Winston.jl/commit/e63f7ef2137a6932143a0c53a2c8e6 > >> 5ecdebec7e>> > >> On Sunday, March 2, 2014 9:47:13 AM UTC+8, Roger Herikstad wrote: > >>> Hi again, > >>> > >>> I did a simple time test by inserting time() calls at the beginning and > >>> > >>> end of my update function. For both my original solution and the one > >>> suggested by Andreas, the function takes about 0.36 seconds with 10000 > >>> points on my laptop. > >>> > >>> On Sunday, March 2, 2014 9:39:11 AM UTC+8, Roger Herikstad wrote: > >>>> Hi, > >>>> > >>>> Thanks for the advice! The initial drawing definitely seems faster > >>>> > >>>> when using zero-length lines. On my Macbook Pro with 8GB of ram, this > >>>> solution seems comparable to the performance of matplotlib when using > >>>> 10000 > >>>> points. Matlab is still much, much faster. I'll try running some proper > >>>> timing experiments to quantify the difference. > >>>> > >>>> On Saturday, March 1, 2014 11:10:56 PM UTC+8, Andreas Lobinger wrote: > >>>>> Hello colleague, > >>>>> > >>>>> On Friday, February 28, 2014 6:59:13 AM UTC+1, Roger Herikstad wrote: > >>>>>> Hi all, > >>>>>> > >>>>>> I tried to get a better understanding of Cairo drawing by > >>>>>> > >>>>>> implementing this solution myself. This is just a proof-of-concept > >>>>>> and I > >>>>>> didn't do any rigorous testing, but subjectively comparing the resize > >>>>>> performance of a Winston scatter plot of ~10000 points and this new > >>>>>> solution, I noticed a significant speed-up. Note that I still find it > >>>>>> too > >>>>>> slow, but that's probably due to my lack of understanding of Cairo. > >>>>>> Basically, this is what I did: > >>>>>> I appreciate any comments on this. Thanks! > >>>>> > >>>>> 1) > >>>>> How do you plan to treat different colors per dot? > >>>>> 2) > >>>>> > >>>>> In a lot of cairo advices, the fastest way for a round dot is: > >>>>> set_line_cap(cr,Cairo.CAIRO_LINE_CAP_ROUND) > >>>>> set_line_width(cr,radius) > >>>>> > >>>>> for i=1:n > >>>>> > >>>>> move_to(cr,px[i],py[i]); > >>>>> rel_line_to(cr,0,0); > >>>>> stroke(cr); > >>>>> end > >>>>> > >>>>> so setting the line end to a ROUND CAP and plot a line of length 0.