I have gotten in the habit of slapping this at the start of any processor intensive method… but to be honest… I’m not sure if I am making the best use of them or not.
And I “assume” these stay in scope for each method… and there is not a way to apply them once (or a less number of times) and get the maximum benefit?
Also are there others that would be beneficial (or determental)?
I only use BackgroundTasks and BoundsChecking, when I use them at all. These will kill the UI, so I only use them in small helper functions to maximize their performance when called from the master method. If something is going to take a really long time, I either use a thread or a timer that works as a pseudo-thread.
I think DisableAutoWaitCursor makes code slower as some things are done to avoid the auto wait cursor.
Also I think bounds check, stack check and nil object checks are important and should not be disabled.
DisableBackgroundTasks can speed up loops a lot and make the app less responsive.
[quote=19519:@Thom McGrath]I use a fake #error pragma like
#if Not DebugBuild
#error Don't ship with this code!
#endif
to be sure to remind myself to do something with the code before it goes out the door.[/quote]
There is an actual pragma for errors, which is a bit better than getting “unknown pragma”:
[quote=19532:@Joe Ranieri]There is an actual pragma for errors, which is a bit better than getting “unknown pragma”:
#pragma error "message"
I should have known…
Regardless, my snippet is largely useless in most situations. DebugBuild is a useless constant to wrap it in. A custom constant is where such a pragma proves useful.