Important: Please read the Qt Code of Conduct -

QQmlApplicationEngine engine slow to construct after installing custom message handler

  • Calling QQmlApplicationEngine engine; needs around 8 seconds, if qInstallMessageHandler(myMessageOutput); is called before.
    Without calling qInstallMessageHandler(myMessageOutput); it needs around 400 milliseconds. Used version is Desktop_Qt_5_6_0_MSVC2015_64bit-Debug.

    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    #include <QElapsedTimer>
    void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
    int main(int argc, char *argv[])
      QGuiApplication app(argc, argv);
      QElapsedTimer timer;
      QQmlApplicationEngine engine; // This line takes around 8 seconds. But without calling qInstallMessageHandler, it takes around 400 milliseconds. Why? 
      qint64 elapsed = timer.elapsed();
      return app.exec();

Log in to reply