- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there an optimal size choice for local variables of LOGICAL data types for efficiency on x86 or x86_64 platforms? I understand the desire to pad alignment of structures or arrays of structures for efficiency, but do non-array stack variables access any quicker for 1-byte vs. 4-byte accesses? Same question for INTEGER*1 or INTEGER*2 vs. INTEGER*4 -- is there any reason to not compress the variable size to the smallest needed to store the expected data?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The instructions for manipulating LOGICALs work better when the data is 32-bit aligned. Unless you have hundreds of thousands of these, the default size is the better choice.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The instructions for manipulating LOGICALs work better when the data is 32-bit aligned. Unless you have hundreds of thousands of these, the default size is the better choice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I agree with Steve with one (rare exception). This is for the special case where your highly exercized procedure (subroutine or function) is on the edge of fitting everything in L1 cache .AND. where you have the opportunity to reclaim some cache lines by packing your logicals and smaller integers. I would suggest you not use the smaller sizes until after you reach the VTune phase and notice/determine a potential for gain.
For hundreds of thousands of logicals, you might consider bit fields. YMMV
Jim Dempsey

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