Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
16 Views

Integer Size

A quick general question. 

Does it provide any benefit (other than some memory savings) to tailor your integer size to fit your data range instead of just assuming INTEGER*4 for all integers? I have numerous integer variables which are used as flag which have values of between -10 and 10. In this case, INTEGER*1 would be the best fit. Is there an optimum integer size for maximum performance using the Intel compiler?  In other words, does using a small integer size impact performance in any way?

Thanks...

0 Kudos
4 Replies
Highlighted
16 Views

No, assuming that the integer size's range is sufficient. For example, if you are using a variable to keep track of indexes or sizes of an object whose size can exceed 2GB, then you'll want it to be the larger size (like C's size_t).

Retired 12/31/2016
0 Kudos
Highlighted
Beginner
16 Views

Thanks Steve.  Just to be sure I understand.  There is no performance penalty in using an integer size small than INTEGER*4.  

Do most people bother to tailor the size of their integer variables?

0 Kudos
Beginner
16 Views

Thanks Steve.  Just to be sure I understand.  There is no performance penalty in using an integer size small than INTEGER*4.  

Do most people bother to tailor the size of their integer variables?

0 Kudos
Highlighted
16 Views

Smaller than INTEGER(4)? No, don't do that - there is a performance penalty. I thought you were asking about using INTEGER(8) on a 64-bit platform. Use INTEGER(4) unless you require a different size.

Retired 12/31/2016
0 Kudos