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/e63f7ef2137a6932143a0c53a2c8e65ecdebec7e 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. >>> >>> >>> >>