On 16-Feb-07, at 7:48 PM, Theodore H. Smith wrote:

From: Frank Condello <[EMAIL PROTECTED]>
Date: Fri, 16 Feb 2007 15:42:39 -0500

On 16-Feb-07, at 3:16 PM, Peter K. Stys wrote:

On 2/16/07, Charles Yeomans <[EMAIL PROTECTED]> wrote:

The best thing would be to be able to pick a representation, say,
little endian, and use it always.  If you have control over reading
and writing of image data, then you should be to do so.


Charles:

this would be easiest, but I suspect not best: if i used say
littleEndian always, then my app running on a bigEndian Mac would
always be forced to either byte-swap a 100 MB file during read/ write,
or worse, force the memblocks to byte-swap every m.ushort access
because m would be set to its unnatural littleEndian setting on a
bigEndian machine.  Or am I missing something?

The overhead of calling ushort is in the function call itself - if
you swap the whole block as Theo suggested you're actually doing
_more_ work. i.e. Calling bytevalue 4 times is way slower than
setting littleendian and calling ushort once. The littleendian
property is just a flag that's checked in every (applicable) accessor
whether the swap happens or not - there's nothing inherently slow
about it.

Simple maths proves you to be wrong.

Simple profiling proves you wrong...

If he is processing the entire file, my approach should be faster. The only thing making my approach slow would be RB itself, seeing as mb.bytevalue() may not be as fast as a pointer.

I wasn't knocking your approach - I was just pointing out that four function calls per swap is slower than one, but you already know that - perhaps the OP did not...

...

If he is processing the entire file mulitple times, then even my code using RB and no plugins is faster than your approach.

If the code you posted used pointers then yes, but it didn't, so no, sorry, it's not faster. Go back and *read* my post - all of it - I recommended a plugin or using Ptr access, you didn't, till now...

Frank.
<http://developer.chaoticbox.com/>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to