- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just a question for someone that knows the compiler, I can use shorts in many place of my code where I use ints.
I understood ints were better for compiling. Using the Intel Compiler is there any advantage to using shorts instead
of ints and if I do is there an optimized compiler setting that will take advantage of short vs ints ?
I guess I will try it, but figure someone might know before hand.
Thanks
Pat
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is the theoretical advantage of being able to process 2x more elements per instruction provided that your code can be automatically vectorized. As you may know, 128-bit XMM register can hold 4 ints or 8 shorts.
Shorts may be batter choice if the arithmetic operations you are performing cannot overflow. Speed gain however will vary with the processor used. Core 2 and newer should have faster SIMD integer units.
The best thing would be to perform a test. Keep in mind though that unsigned shorts have limited support at the instruction level so some loops which can be vecotrized using short cannot if you change data to unsigned short.
I doubt you will see much speedup unless you process a lot of data though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page