Results 1 to 4 of 4

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

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2011
    Posts
    86
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Does using many qDebug() in code influence efficiency of ap in release mode?

    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.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Does using many qDebug() in code influence efficiency of ap in release mode?

    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.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Does using many qDebug() in code influence efficiency of ap in release mode?

    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:

    Qt Code:
    1. int& inc(int &i) { return ++i; }
    2.  
    3. int a = 0;
    4. qDebug() << inc(a);
    To copy to clipboard, switch view to plain text mode 
    the value of "a" will still be 0! The line with qDebug() will be completely ignored.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Sep 2011
    Posts
    86
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Does using many qDebug() in code influence efficiency of ap in release mode?

    I would give you thanks but you have them too many

Similar Threads

  1. Replies: 1
    Last Post: 7th March 2012, 21:34
  2. How to find debug or release mode using code?
    By Gokulnathvc in forum Newbie
    Replies: 1
    Last Post: 14th December 2011, 07:42
  3. Replies: 1
    Last Post: 11th March 2010, 21:30
  4. Replies: 1
    Last Post: 25th December 2009, 19:43
  5. Replies: 1
    Last Post: 2nd November 2009, 12:02

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.