Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Slow work in Qt Creator



  • Hi guys. I'm in strange situation, when I'm execute this trivial test code in Qt Creator (using non static release build Qt 4.8):
    @#include <QCoreApplication>
    #include <QtCore>
    #include <QDebug>
    #include <QTime>

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);

    int times = 3;
    int len = 500;
    int kmer = 9;
    
    QFile file&#40;"D:\\one.txt"&#41;;
    file.open(QIODevice::ReadOnly&#41;;
    
    QString strand = file.readLine(&#41;;
    strand.remove("\n"&#41;;
    
    QSet<QString> answersKmers;
    QString nextKmer;
    qDebug(&#41; << "Start";
    QTime timer;
    timer.start();
    for(int i = 0; i < strand.size() - kmer + 1; ++i)
    {
        nextKmer = strand.mid(i ,  kmer);
    
        if(!answersKmers.contains(nextKmer))
        {
            if(strand.mid(i,  len).count(nextKmer) >= times)
                answersKmers.insert(nextKmer);
        }
    }
    qDebug() << QString("End in %1 seconds").arg(timer.elapsed() / 1000);
    
    qDebug() << "9-mers form (500,3)-clumps in the E. coli genome: " << answersKmers.size();
    
    return a.exec(&#41;;
    

    }
    @
    it's works many minutes, but if execute .exe file of this program from explorer, it will works 4 seconds. I can't understand why! At my friend PC its works good even in Creator. What's the problem it can be?

    P.S. On my netbook with Debian it works in Creator fine too.


  • Lifetime Qt Champion

    Hi,

    When running from explorer did you first follow the "windows development guide":http://qt-project.org/doc/qt-4.8/deployment-windows.html ?



  • [quote author="SGaist" date="1382817656"]Hi,

    When running from explorer did you first follow the "windows development guide":http://qt-project.org/doc/qt-4.8/deployment-windows.html ?[/quote]
    When running from explorer, I'm just double click and all fine :)
    In Creator if running from F5 (debugger) it will be so slow (minutes instead of seconds), but if push CTRL+R (just run) everything will be ok. This I have described release mode. I can't understand what with debagger - on netbook with Debian all ok from F5.


  • Lifetime Qt Champion

    It can depend on several things, the debugger you are using, the number of libraries you are using etc...


Log in to reply