Re: Drawing many thin vertical lines is very slow
Re: Drawing many thin vertical lines is very slow
- Subject: Re: Drawing many thin vertical lines is very slow
- From: Jens Alfke <email@hidden>
- Date: Thu, 07 May 2015 22:24:33 -0700
> On May 7, 2015, at 9:43 PM, Michael David Crawford <email@hidden> wrote:
>
> If I autorotate, redrawing the vertical lines takes hundreds
> of times as long as redrawing the horizontal lines. That makes sense
> as one can draw a horizontal line by incrementing a pointer into the
> image buffer. To draw a vertical line one has to draw a pixel, then
> calculate the memory address of the next pixel vertically downwards.
That intuition is a couple decades out of date :) All the rendering nowadays is done by dedicated GPU hardware that can draw millions of polygons per second without breaking a sweat.
(Even back then, I don’t think it made much difference whether the increment was horizontal or vertical. The bigger win was that in low-bit-depth displays you could fill multiple horizontally adjacent pixels in one write operation. That advantage went away with 32bpp.)
That said, I don’t know why the vertical lines would be slower. The first thing I’d try would be to draw the entire grid as a single path using CG.
—Jens
_______________________________________________
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