• 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: @try @catch
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: @try @catch


  • Subject: Re: @try @catch
  • From: j o a r <email@hidden>
  • Date: Thu, 14 Aug 2008 18:06:17 -0700


On Aug 14, 2008, at 5:34 PM, Andrew Farmer wrote:

Python has been optimized to handle exceptions quickly, so it's often faster to catch exceptions than to check for exceptional situations in Python code. Objective-C has not been similarly optimized*, so checking for errors before attempting operations will be much faster than catching exceptions unless the exceptions are exceedingly rare.

*: Or, more accurately, the overhead of setting up exceptions is much higher compared to the overhead of checking for situations that would trigger them.


The cost, and where you pay it, depends on many factors: The type of exceptions handler you use, and the version of Mac OS X and the version of the Objective C runtime you happen to execute on.

That said, and has been pointed out earlier in this thread, the decision to use exceptions for control flow or not is not simply one, perhaps not even primarily one, of performance considerations.

j o a r


_______________________________________________

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


References: 
 >@try @catch (From: Georg Seifert <email@hidden>)
 >Re: @try @catch (From: Andrew Farmer <email@hidden>)

  • Prev by Date: Re: NSPanel not receiving events.
  • Next by Date: Re: Cocoa and SOAP without WebServicesCore
  • Previous by thread: Re: @try @catch
  • Next by thread: Updating current managedobject
  • Index(es):
    • Date
    • Thread