Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29281 Discussions

Stack vs. Save attribute and performance

ahasan
Beginner
690 Views
If a subroutine or functions is called repeatedly, such as the MainWindowProc() in a win32 program, is it better to use the SAVE attribute for all variables in that function or subroutine rather than using the stack?
I am curious about how this affects program performance or efficiency.
0 Kudos
2 Replies
Steven_L_Intel1
Employee
690 Views
Using SAVE will defeat some optimizations. Such routines don't tend to have large local variables, so the performance difference relative to the allocation type is probably not measurable. Stack is friendlier to cache than static.
0 Kudos
ahasan
Beginner
690 Views
Thanks Steve. I appreciate the reply and info.
0 Kudos
Reply