Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Operation on different data types

Tags:

java

c++

c

Considering the basic data types like char, int, float, double etc..in any standard language C/C++, Java etc

Is there anything like.."operating on integers are faster than operating on characters".. by operating I mean assignment, arithmetic op/ comparison etc. Are data types slower than one another?

like image 728
EFreak Avatar asked Apr 13 '26 03:04

EFreak


1 Answers

For almost anything you're doing this has almost no effect, but purely for informational purposes, it is usually fastest to work with data types whose size is machine word size (i.e. 32 bits on x86 and 64-bits on amd64). Additionally, SSE/MMX instructions give you benefits as well if you can group these and work on them at the same time

like image 193
Ana Betts Avatar answered Apr 14 '26 15:04

Ana Betts