Re: GCD killed my performance
Re: GCD killed my performance
- Subject: Re: GCD killed my performance
- From: Jens Alfke <email@hidden>
- Date: Thu, 24 Apr 2014 22:49:58 -0700
On Apr 24, 2014, at 10:30 PM, Quincey Morris <email@hidden> wrote:
> Approaching this naively, this result suggests that the block content, while not trivial, is too fine-grained — is divided too finely. For example, if you’re putting (essentially) one database read/write operation (or even a handful) in each block, perhaps that’s too small a unit of work for GCD.
I’m coming to that conclusion. I thought that a file-based b-tree lookup would be complex enough to drown out that overhead, but maybe not.
> a physical disk access is presumably much slower on average than an access to iOS persistent memory. (Of course, if your MacBook Pro is purely SSD, that might blow that idea out of the water. I don’t know how SSD access speeds compare to iOS memory.)
No, you’ve got it backwards. My 2012 MacBook Pro has a damn fast SSD (one of the Apple on-the-motherboard ones), but the flash storage on iOS devices is really slow, slower than a decent hard disk.
I interpret the difference in performance as showing that, while there’s a lot of extra CPU overhead to using GCD, it’s still a net win when it lets you spread your code out over eight cores instead of one. But when there are only two cores, it seems to be not worth the expense.
> Unless I missed something, all of the responses in this thread went to the GCD issue. But if memory management is showing up “hot” like that too, there may be something else to investigate.
It is, but most of it appears to be memory management _caused_ by GCD, since it goes away when I replace the dispatch calls with @synchronized. GCD is apparently causing a lot of blocks to get copied to the heap.
—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