Thread overview
Fast variables (8/16/32 bit)
May 05, 2003
Keith Fuller
May 05, 2003
Walter
May 07, 2003
Javier Gutiérrez
May 08, 2003
roland
Jun 21, 2003
Shawn Poulson
Jun 24, 2003
Keith Fuller
Jun 25, 2003
Javier Gutiérrez
May 05, 2003
Hello.

I have a question that I have been curious about for some time.

Let's say I have to represent an integer that can only have values between 1 and 10.

In general, which would be the fastest?

8-bit byte
16-bit short
32-bit integer

Cheers!

Keith Fuller

keithfx@hawtmail.com (<--you know what I mean)



May 05, 2003
On later intel processors, 32 bits.

"Keith Fuller" <Keith_member@pathlink.com> wrote in message news:b9689u$n73$1@digitaldaemon.com...
> Hello.
>
> I have a question that I have been curious about for some time.
>
> Let's say I have to represent an integer that can only have values between
1 and
> 10.
>
> In general, which would be the fastest?
>
> 8-bit byte
> 16-bit short
> 32-bit integer
>
> Cheers!
>
> Keith Fuller
>
> keithfx@hawtmail.com (<--you know what I mean)
>
>
>


May 07, 2003
    The general rule is that the natural word machines are the faster.
    16 bit for 286 or lower, 32 bit for 386+.

"Walter" <walter@digitalmars.com> escribió en el mensaje news:b96hk1$10dq$1@digitaldaemon.com...
> On later intel processors, 32 bits.
>
> "Keith Fuller" <Keith_member@pathlink.com> wrote in message news:b9689u$n73$1@digitaldaemon.com...
> > Hello.
> >
> > I have a question that I have been curious about for some time.
> >
> > Let's say I have to represent an integer that can only have values
between
> 1 and
> > 10.
> >
> > In general, which would be the fastest?
> >
> > 8-bit byte
> > 16-bit short
> > 32-bit integer
> >
> > Cheers!
> >
> > Keith Fuller
> >
> > keithfx@hawtmail.com (<--you know what I mean)
> >
> >
> >
>
>


May 08, 2003
hello

Javier Gutiérrez a écrit:
>     The general rule is that the natural word machines are the faster.
>     16 bit for 286 or lower, 32 bit for 386+.
>

hum .. it seems to me that it depend on the model too. manipulating 32 bit datas with 16 bit registers is quite slow !
at least 16 bit datas should be aligned on 32 bit boundary
using 32 bit registers on 16 bit model ? it works (use assembly)
i don't know if it is faster but i know it adds a 8 bit opcode.

roland



> "Walter" <walter@digitalmars.com> escribió en el mensaje
> news:b96hk1$10dq$1@digitaldaemon.com...
>
>>On later intel processors, 32 bits.
>>
>>"Keith Fuller" <Keith_member@pathlink.com> wrote in message
>>news:b9689u$n73$1@digitaldaemon.com...
>>
>>>Hello.
>>>
>>>I have a question that I have been curious about for some time.
>>>
>>>Let's say I have to represent an integer that can only have values
>>
> between
>
>>1 and
>>
>>>10.
>>>
>>>In general, which would be the fastest?
>>>
>>>8-bit byte
>>>16-bit short
>>>32-bit integer
>>>
>>>Cheers!
>>>
>>>Keith Fuller
>>>
>>>keithfx@hawtmail.com (<--you know what I mean)
>>>
>>>
>>>
>>
>>
>
>


June 21, 2003
"Walter" <walter@digitalmars.com> wrote in message news:b96hk1$10dq$1@digitaldaemon.com...
> On later intel processors, 32 bits.

My understanding is that 386 and newer processors are well optimized for simple algebra with 8/16/32-bit registers.  Any add/sub operation will only take 1 clock (or close to it) regardless if it's using AL, AX, or EAX. However, I'm not sure how it reacts with div/mul.

I would be interested in seeing someone profile these types of operations.


June 24, 2003
I think it is more a matter of memory access. Inside the CPU, yes, it probably doesn't matter.

keithfx@h*tmail.com

In article <bd0kr0$mq2$1@digitaldaemon.com>, Shawn Poulson says...
>
>My understanding is that 386 and newer processors are well optimized for simple algebra with 8/16/32-bit registers.  Any add/sub operation will only take 1 clock (or close to it) regardless if it's using AL, AX, or EAX. However, I'm not sure how it reacts with div/mul.
>
>I would be interested in seeing someone profile these types of operations.
>


June 25, 2003
    Yes, it is a memory issue.
    You can get the complete info at
http://www.penguin.cz/~literakl/intel/intel.html

"Keith Fuller" <Keith_member@pathlink.com> escribió en el mensaje news:bd9pv0$1klh$1@digitaldaemon.com...
> I think it is more a matter of memory access.
> Inside the CPU, yes, it probably doesn't matter.
>
> keithfx@h*tmail.com
>
> In article <bd0kr0$mq2$1@digitaldaemon.com>, Shawn Poulson says...
> >
> >My understanding is that 386 and newer processors are well optimized for simple algebra with 8/16/32-bit registers.  Any add/sub operation will
only
> >take 1 clock (or close to it) regardless if it's using AL, AX, or EAX. However, I'm not sure how it reacts with div/mul.
> >
> >I would be interested in seeing someone profile these types of
operations.
> >
>
>