PDA

View Full Version : Does using many qDebug() in code influence efficiency of ap in release mode?



code_err
12th March 2012, 23:17
As in title. I use many "qDebug() << " statements for tests purposes and don't know if i should remove them before release mode compilation? Are they compiled during release mode compilation? I'm afraid they will affect the efficiency.

ChrisW67
12th March 2012, 23:33
From Debugging Macros:


Both qDebug() and qWarning() are debugging tools. They can be compiled away by defining QT_NO_DEBUG_OUTPUT and QT_NO_WARNING_OUTPUT during compilation.

While not disappearing entirely, they are replaced with minimal do-nothing versions and should have very little impact on performance.

wysota
13th March 2012, 07:47
Just to be precise --- debug statements do not go away in release mode and they have impact on the final performance of the application.

If you define QT_NO_DEBUG_OUTPUT they do go away completely, meaning that if you have the following code:


int& inc(int &i) { return ++i; }

int a = 0;
qDebug() << inc(a);
the value of "a" will still be 0! The line with qDebug() will be completely ignored.

code_err
13th March 2012, 11:50
I would give you thanks but you have them too many ;)