Re: Strangeness when moving data through an array.
Re: Strangeness when moving data through an array.
- Subject: Re: Strangeness when moving data through an array.
- From: Sherm Pendley <email@hidden>
- Date: Wed, 1 Dec 2004 18:03:51 -0500
On Dec 1, 2004, at 4:25 PM, Jeff Laing wrote:
There tis. "Alignment interrupt handler". Keep your data accesses
aligned
the way the CPU likes or suffer the performance penalty.
Ah, that makes it clearer, thanks. When I read "exception" I was
imagining a core dump. That link makes it clear that the host OS is
expected to trap and handle the exception.
In John's case I think a performance hit of one kind or another is
unavoidable. He has no control over how is data is aligned - it's read
from an external source and stored in a buffer.
If he tries to read a whole short at once, then depending on where his
buffer is allocated and the offset of the data he wants in the buffer,
he *might* get lucky and avoid the exception. If he reads the bytes one
at a time and adds them, he'll be trading that chance for the certainty
of doing the arithmetic ops every time.
Either way the penalty is just a few cycles - probably not worth
worrying about unless it executes millions of times and profiling shows
that it's a bottleneck.
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden