Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Asynchronous OT calls on Mac OS X?



I dont know how much this will help, but this is some of what we learned
at WWDC.

All OT calls on OS X are simulated using standard BSD sockets calls and
threads. In general there will be about 10% performance penalty for this.

I suspect you may have hit a case where the underlying implementation is
not expecting someone do something like this and has less than optimized code.

One conclusion that I drew from the information from the conference is
that if you're serious about OS X development is could be beneficial to
treat it as another platform and code directly to it. Of course this is
dependent on your performance needs and results. Apple couldnt stress
this enough: profile your code. OS X has different performance
characteristics than OS 9.

It seems for your case looking at how to do this directly on OS X may be
beneficial.

..Duane

--- At Thu, 7 Jun 2001 19:48:26 +1000, Richard Fox wrote:

>Is there any documentation specifically relating to the changes I need
>to make to a Carbon-ported app to get good performance from async OT
>calls on OS X?
>
>My app does a huge list of reverse DNS lookups, so the best way to
>handle it is to use async calls with a notifier function so that the
>calls can be queued up as some calls will return before others.
>
>So, the calling sequence goes like this ...
>
>InitOpenTransportInContext
>OTOpenInternetServicesInContext
>OTInstallNotifier
>OTSetAsynchronous
>OTSetNonBlocking
>
>for each IP address then it loops ...
>
>{
> OTInetStringToHost
> OTInetAddressToName
>}
>
>This works fine, it hits the notifier function and gets the resolved
>address. The only problem is it is mind-bogglingly slow, perhaps 10
>times slower than on OS 9. So I'm guessing it has something to do with
>the event model on OS X. I'm using WaitNextEvent(), and everywhere in
>the code now I'm using 0x7FFFFFFFF for the sleep time as recommended to
>make sure that the OS doesn't spend too much time polling. This doesn't
>seem to have made much difference, so I'm not sure what else I can do.
>Should the process be non-blocking or blocking, and do I have to do
>other things in my event loop to free up more time? Should I be using
>true threading for this with synchronous calls?
>
>Hoping someone has already worked this one out!


References: 
 >Asynchronous OT calls on Mac OS X? (From: Richard Fox <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.