Overhead of if (DEBUG)

C

Chris

I'd like to leave some debugging functions in my code like this:

static final boolean DEBUG = true;

if (DEBUG) {
// do stuff here
}

Certain sections of my code are truly time-critical (and yes, I've
benchmarked it, and any delay is a problem). If I leave the debug code in
the app and set the static final DEBUG constant to false, will there be any
overhead? Is the compiler smart enough to omit the debug code altogether
when loading the class?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top