On Oct 28, 2006, at 1:13 PM, Jan E. Schotsman wrote:
On 28-okt-06, at 21:02, Bruce Johnson wrote:
I'm looking for help in performing math operations to very large
arrays.
I don't think these simple operations are in the Accelerate framework.
vForce only has special functions applied to arrays.
So you need a third party library like macstl or just write the
code yourself.
In this case use vec_sub or vec_subs on Altivec and _mm_sub_epi8 or
_mm_subs_epu8 on Intel.
(Sorry to drag up old threads, I just got back from vacation.)
Tiny little functions that do very little arithmetic on data like the
subtraction example provided don't perform very well on modern
processors. If you take the time to disassemble your code, you'd see
that for every subtract there are as many as 3x as many LSU
operations, which become the bottleneck and slow the calculation way
down.
You are almost always better off writing whatever complicated
arithmetic you need as a single function, rather than try to build it
out of a bunch of little ones.
If you *really* need these things, you can find some of them in
vDSP.h. However be warned that they are not the panacea that you may
think they are and when used in aggregate may actually perform slower
than scalar code in some cases. Something like MacSTL or writing your
own vector code is a better choice. vDSP provides them for the rare
case where the *only* thing you need to do is the simple operation.
Ian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden