Re: AltiVec optimization in Cocoa?
Re: AltiVec optimization in Cocoa?
- Subject: Re: AltiVec optimization in Cocoa?
- From: Brendan Younger <email@hidden>
- Date: Sun, 19 May 2002 18:18:02 -0500
On Sunday, May 19, 2002, at 02:21 PM, Mamdouh wrote:
Ok i read the documents and what you are saying is makes pretty much
sence! Answer: It is possible to optimize your own functions for
AltiVec by using the C based AltiVec interface from within your
Objective-C class!
Apple says: "You can program in C++ and Objective C using the AltiVec C
programming interface, in the same way that you can use ordinary C
functions and data types in C++ and Objective C."
And they posted a couple of examples on how to do so, but it looks like
a hell of a lot of work! Try looking at the Hello World AltiVec
example... See how different it is from the normal way to make a Hello
world! And then try looking at the other examples, looks very wired! So
as long as my app runs great and some of the optimization is allready
done for me, and my app doesnt need to process 200MB chunks of EPS
files, i am sticking to regular Cocoa! But maybe just maybe i could
optimze a very small part of my apps that requires a lot of processer
power!
That is precisely what you're supposed to use AltiVec for. Automatic
vectorization is extremely tricky to implement simply because the
compiler doesn't have the context that the programmer is working in. If
the programmer knows a certain routine will be called some 3,000 times
(or something like that), they can optimize it for AltiVec. As far as
-faltivec, all it does is optimize the AltiVec code that you yourself
put in, it does not create any AltiVec instructions.
However, I would suggest at least learning AltiVec. It's not very hard
and many, many even slightly scientific applications could benefit.
Take something like JPEG compression/decompression. It's ridiculously
faster in AltiVec (I wrote a DCT that transforms and 8x8 block in 87
clock cycles). Compare that to a straight C version and it's *at least*
3-4 times faster. Not to mention that it's much, much better than MMX
or SSE for the same tasks. (That's why all those Photoshop filters are
still faster on the Mac.)
Brendan Younger
_______________________________________________
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.