Multithreading NSBezierPath creation and stroking. Measuring performance
Multithreading NSBezierPath creation and stroking. Measuring performance
- Subject: Multithreading NSBezierPath creation and stroking. Measuring performance
- From: Karolis Ramanauskas <email@hidden>
- Date: Tue, 27 Oct 2009 02:05:28 -0500
Good day,
For the last few days I've been working on my own "2D Scatter Plot View" all
is going great and it looks nice:
http://i729.photobucket.com/albums/ww297/karolisr/Screenshot2009-10-27at12636AM.png
At this point I started optimizing drawing, so I implemented some cacheing,
etc. and I see significant performance gains. Now my attention is on drawing
multiple series as can be seen in the picture above. I decided that this is
a great place to introduce some multithreading (note that I have never done
any multithreading until two days ago). I've been reading documentation and
this is what I came up with:
1. For each series create an operation using NSInvocationOperation
2. The operation consists of:
- looping through the points in the series and creating an
NSBezierPath
- creating NSBitmapImageRep
- creating NSGraphicsContext with that NSBitmapImageRep
- stroking the path onto that Bitmap
- adding Bitmap to an array
3. In the queue I wait until all the operations are finished and then
proceed to loop over all Bitmaps and drawing them
I will post detailed code in reply to this post soon (original message was
too big and required approval). My questions are:
1. Is this a correct approach?
2. How do I measure (using instruments, I guess) the performance gain, if
any?
Thanks to everyone,
Karolis
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden