Reputation: 77
I need to graph a large amount of data points using straight lines and an affine transformation (to scale the graphic so it can fit the view).
Currently, I am using NSBezierPath, but I believe it is quite inefficient (because points are copied to the bezier path prior to being graphed). I got improvements by cutting my data into 50-points chunks (NSBezier path is much faster).
But I understand there may be a better way using core graphic or CG.... function calls ?
My app is written in swift.
Upvotes: 2
Views: 812
Reputation: 32497
First of all, if you can: profile your app and try to determine where your performance bottleneck lies.
My experience is that Core Graphics is not really quick at anything.
If you want to rasterize straight lines fast, you might want to research OpenVG implementations (there appears to be several open source implementations for iOS) or even use OpenGL directly. Of course, this assumes rendering lots and lots of lines fast is a differentiator for your app making it worth the effort.
Upvotes: 1