- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve. I appreciate the reply and info.
![](/skins/images/8B5EA638CA3587CA763EE9EF53643DD4/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page