Mail Archives: djgpp/1998/08/13/03:30:25
Nate Eldredge wrote:
> Endlisnis wrote:
> >
> > Eli Zaretskii wrote:
> >
> > > More accurately, use int where its size doesn't matter and you want the
> > > fastest code, and short/long where the size matters.
> >
> > Are you saying that 'int's are faster than 'short's in DJGPP?
>
> They are. The x86 can execute 32-bit instructions just as fast as
> 16-bit ones. However, when in protected mode, the 32-bit form is the
> default. To execute the 16-bit form requires a one-byte prefix (66h,
> usually). This adds a byte to the size of the code, and also requires
> an additional cycle to decode.
>
> That is not necessarily true in general, but often is.
> --
>
> Nate Eldredge
> nate AT cartsys DOT com
In a source file I saw recently, the programmer had commented: "Change to
shorts so
fits in the CPU cache better." This is DJGPP code (of course :-) This does of
course
make sense to me.
So which is faster: shorts, from the cache, but with the 16 bit override, or
ints (longs) with no 16 bit overide but possibly overflowing the cache?
The array has between 322 to about 1080 elements.
Kester Maddock
dmaddock AT xtra DOT co DOT nz
- Raw text -