Frank Klemm wrote:
> ::
> :: programmers don't document, you know ;-)
> :: OK, your point is clear and I'll try to add more comments
> :: (hopefully useful remarks..)
> ::
> :: > * Don't use single 'short' variables to save storage.
> :: > Short variables are especially on Pentium Class Computer much slower than
> :: > int's. DEC alpha also hates short variables.
> :: >
> :: > Example: float bla [1024];
> :: > short i;
> :: > for ( i = 0; i < 1024; i++ )
> :: > bla [i] = i;
> ::
> :: I'm not so sure about shorts. Documents on the Intel compiler suggest
> :: for example to put the index variables of nested loops in a struct
> :: to improve cache performance, this way they would be in the same cache line.
> ::
> May be this plays a role, but only if you have more than 8 loops. And if you
> have more than 8 loops, the performance of the outer loops becomes very
> unimportant.
>
> In 32 bit mode the pentium supports 8 bit and 32 bit. 16 bit need the
> operand size prefix. This is slow.
>
> DEC Alpha cannot handle 16 bit int's at all. The compiler generates a lot of
> bit shifting and masking stuff.
IIRC the "int" type is the fastest on all ( most ) compilers.
I.E. :
On 16 bit systems is int16
On 32 bit systems it is int32
On 64 bit systems ( alpha ) it is int64 ( unless tweaked to 32 bit for
bugward compatibility )
So for loop counters and like, "int" should be used.
David Balazic
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )