What are you storing in your ints/longs, what operations are you doing
on them, and how significant is the difference in speed that you
observe under what cicumstances?

Choosing a type based on speed will generate potentially unportable
code, whereas choosing a type based on what data you will actually
store will be safer.

There are type called int_fast32_t, uint_fast64_t etc. (from 8 to 64
bits, both int and uint) in the C standard, in <stdint.h>.  They are
supposed to be the fasted integer type of at least the mentioned
number of bits. Use these and pick the width that you will actually
need.

Regards,
Andreas

ps.  You and I talked about something similar before:
http://monkey.org/openbsd/archive/misc/0305/msg00448.html
The difference is that <stdint.h> now exists in OpenBSD...

On 12/05/06, Gustavo Rios <[EMAIL PROTECTED]> wrote:
Hey folks,

i am writing a program to perform some tasks i would like to do. I am
running 3.8 on 64 bit box, for now.

While playing around with int a long types i could see a performance
improvement when using long type over the same method using int type.
What is the theory behind this increase on performance?

If theory validades the practice, could i infere i should always use
long instead of int on my 64 machines?

Thanks a lot for your time and cooperation.

Best regards.




--
Andreas Kahari
Somewhere in the general Cambridge area, UK

Reply via email to