Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
May 05, 2003 Fast variables (8/16/32 bit) | ||||
---|---|---|---|---|
| ||||
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 Re: Fast variables (8/16/32 bit) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Keith Fuller | 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 Re: Fast variables (8/16/32 bit) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | 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 Re: Fast variables (8/16/32 bit) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Javier Gutiérrez | 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 Re: Fast variables (8/16/32 bit) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "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 Re: Fast variables (8/16/32 bit) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shawn Poulson | 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 Re: Fast variables (8/16/32 bit) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Keith Fuller | 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. > > > > |
Copyright © 1999-2021 by the D Language Foundation