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: Handles and Pointers [was: performance issues]



on Thu, Mar 31, 2005 Laurence Harris <email@hidden> may have said:

>The next question then, is why isn't the NewPtr mechanism implemented as
>efficiently as Steve thinks my substitute would be? If that were the case
>then it would be a non-issue. All the code currently using GetPtrSize would
>be more efficient and lots of developers could so something more productive
>with their time instead of having to worry about this kind of stuff and
>changing code. Apple drops the ball again.

NewPtr and GetPtrSize are pretty damn efficient; they are very thin
wrappers with negligable overhead. Profile your code. Then do all these
memory allocation optimizations. Reprofile your code. I'll be extremely
shocked if your profile changes in any meaningful fashion.

Of course, using Handles is going to be tiny bit more costly since they
require a tiny bit more overhead. Again, I'd be shocked if your profile
results showed a difference; and if they did I am 99.9% certain that the
code shouldn't have been using such a memory setup in the first place
(with either ptrs, handles or malloc).

You can _always_ code something thats faster than a routine in the Mac OS
X API because you can code it specific to your program and do not have to
worry about years of legacy code, thousands of different applications,
and millions of lines of other code needing to be written to ship an
operating system. You just have to pick and choose what's important to
your application.

Personally, I consider memory management under Mac OS X to be one of the
things Apple implemented best. I have lots of other things I'd like to
see fixed for a 10=20% speed increase instead of a .001% :)

Lane Roathe
President          Ideas From the Deep        <http://www.ifd.com>
___________________________________________________________________
I am Pentium of Borg. Precision is futile. You will be approximated.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to 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.