• 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: Inline Functions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inline Functions


  • Subject: Re: Inline Functions
  • From: "John C. Randolph" <email@hidden>
  • Date: Mon, 10 Mar 2003 16:16:07 -0800

On Monday, March 10, 2003, at 04:00 PM, email@hidden wrote:

Is there a way to inline Obj-C functions?

I have some objects that I'd like to inline some of the functions to where the function is called.

YOu can inline functions in Obj-C the same way you would in ANSI-C, since Obj-C is a superset of ANSI C. I suspect though, that what you're really asking is whether you can inline an Obj-C method, and the answer to that is no. If you want to save the cost of looking up a method at runtime, there is a technique called "IMP caching", where you can look up a pointer to the code of a method, and call it directly instead of using Obj-C message dispatch.

Of course, it's probably not worth your time to do this until you've actually measured the performance of your app and identified method lookup as a place where you're spending a lot of CPU time.

-jcr

John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Inline Functions (From: email@hidden)

  • Prev by Date: Re: Code for parsing Objective-C files?
  • Next by Date: Re: Inline Functions
  • Previous by thread: Inline Functions
  • Next by thread: Re: Inline Functions
  • Index(es):
    • Date
    • Thread