• 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: Question: What is the impact of changing .cpp AudioUnitEffectsource to .mm
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question: What is the impact of changing .cpp AudioUnitEffectsource to .mm


  • Subject: Re: Question: What is the impact of changing .cpp AudioUnitEffectsource to .mm
  • From: "Stephen F. Booth" <email@hidden>
  • Date: Sun, 20 Jun 2010 15:04:23 -0700

> Most importantly, objc_msgSend can block.
 
It can?  Doing what (I'm curious)?  I know from my own (somewhat superficial) investigations that the first call is slower because some kind of lookup takes place but is there something else?  MTCoreAudio uses objC calls (actually NSInvocation, if memory serves) in its IOProc, FWIW, and the overhead of a method call, on Intel, after the initial lookup, as measured by me in gdb, is about 25 instructions.  Or as Brian says, cache an IMP via -[NSObject methodForSelector:], which is then just a call through a pointer and thus slightly faster than a C++ virtual function call.  Having said all of which, I coded my audio stuff in C++.

objc_msgSend can block when it is called for the first time for a particular class/selector combination (see http://www.friday.com/bbum/2010/02/04/objc_msgsend-tour-part-4-method-lookup-some-odds-and-ends/). When this path of objc_msgSend is taken the method is resolved and cached (as you said), and the relevant +initialize methods are called where a lock is taken to ensure thread-safety (see http://www.friday.com/bbum/2009/09/06/iniailize-can-be-executed-multiple-times-load-not-so-much/). So depending on how your Objective-C classes are written the hit could be minimal or substantial.

I don't know if this is the only time that objc_msgSend might block, but if you are an assembly wizard (I'm not!) the code is available at http://www.opensource.apple.com/source/objc4/objc4-437.1/runtime/Messengers.subproj/objc-msg-x86_64.s

Stephen
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Question: What is the impact of changing .cpp AudioUnitEffectsource to .mm
      • From: "Paul Sanders" <email@hidden>
References: 
 >Question: What is the impact of changing .cpp AudioUnitEffect source to .mm (From: Motti Shneor <email@hidden>)
 >Re: Question: What is the impact of changing .cpp AudioUnitEffect source to .mm (From: Brian Willoughby <email@hidden>)
 >Re: Question: What is the impact of changing .cpp AudioUnitEffect source to .mm (From: Kyle Sluder <email@hidden>)
 >Re: Question: What is the impact of changing .cpp AudioUnitEffectsource to .mm (From: "Paul Sanders" <email@hidden>)

  • Prev by Date: Re: Question: What is the impact of changing .cpp AudioUnitEffectsource to .mm
  • Next by Date: Sorry, still no control update
  • Previous by thread: Re: Question: What is the impact of changing .cpp AudioUnitEffectsource to .mm
  • Next by thread: Re: Question: What is the impact of changing .cpp AudioUnitEffectsource to .mm
  • Index(es):
    • Date
    • Thread