• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: GCD killed my performance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GCD killed my performance


  • Subject: Re: GCD killed my performance
  • From: Kyle Sluder <email@hidden>
  • Date: Sat, 26 Apr 2014 12:02:13 -0700

> On Apr 25, 2014, at 10:35 AM, Seth Willits <email@hidden> wrote:
>
>> On Apr 25, 2014, at 8:08 AM, Jens Alfke <email@hidden> wrote:
>>
>> I’m ending up at the opposite of the received wisdom, namely:
>> * dispatch_sync is a lot cheaper than dispatch_async
>> * only use dispatch_async if you really need to, or for an expensive operation, because it will slow down all your dispatch_sync calls
>
> Saying "dispatch_async will slow down *all* dispatch_sync calls" throws up red flags for me.
>
> In my mind there's still a possibility that You're Doing It Wrong.

FWIW, I’ve been of the opinion for a while that including dispatch_sync in the API was a mistake.  Too often it becomes a crutch used without understanding, resulting in stop-start behavior across threads or cores. The correct solution is usually to rewrite the code in continuation-passing style, even if that means a cascade of blocks. Microsoft realized this when designing WinRT and _removed all the synchronous APIs_. They also added the async/await keywords to C# to avoid the seventeen-levels-of-indentation problem that plagues ObjC code.

Some people at Apple agree that use of dispatch_sync is a code smell, but that if they didn't include it a hundred different re-implementations would arise, all differently broken.

--Kyle Sluder
_______________________________________________

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


  • Follow-Ups:
    • Re: GCD killed my performance
      • From: Quincey Morris <email@hidden>
References: 
 >Re: GCD killed my performance (From: Jonathan Taylor <email@hidden>)
 >Re: GCD killed my performance (From: Jens Alfke <email@hidden>)
 >Re: GCD killed my performance (From: Seth Willits <email@hidden>)

  • Prev by Date: Re: ARC Retain Cycles
  • Next by Date: Re: ARC Retain Cycles
  • Previous by thread: Re: GCD killed my performance
  • Next by thread: Re: GCD killed my performance
  • Index(es):
    • Date
    • Thread