dondora said:
hello~!
I'm coding a simple program which demands fast speed.
and my cpu is 32bits.
which one is faster in processing array and loop? char? int?
This is the wrong group for such questions. Code performance is
intimately tied to compiler specific optimisations, hardware
capabilities and many other details. The C Standard says nothing about
the performance of C code.
<OT>
On a 32 bit system, it is very likely single operations on int are more
faster than on char. However for a very large array of such objects,
the memory saved by using char could very easily outweigh the fact that
native instructions on int are faster. All that the C Standard says is
that the type int is most likely to correspond to the native "word
size" of the underlying processor, hence it is most likely that (given
that other factors are equal), operations on it are faster than on a
char.
The only truly conclusive method to evaluate performance is to actually
test the code.
</OT>