Coder Social home page Coder Social logo

Comments (3)

BensonLaur avatar BensonLaur commented on July 22, 2024

我参考了 https://segmentfault.com/a/1190000020723673 这里写了一个测试 qDebug 的单独一个小程序

#include <QDebug>
#include <QElapsedTimer>
#include <iostream>
#include <QFile>
/* 注:单独打开某个宏测试 */

int main(int argc, char *argv[])
{
        QElapsedTimer t;
        qint64 it = 0;
        t.start();
        while (t.elapsed() < 1000) {
            qDebug() << "Test1 ==============-----------------===========";
            it++;
        }

        qDebug() << "Test1: " << it;

        QFile file("C:/Users/BensonLaur/Desktop/cout.txt");
        file.open(QIODevice::WriteOnly | QIODevice::Text);
        file.write(QString("count:%0").arg(it).toUtf8());
        file.close();
}

该程序做的事是在 1000ms 内计算 it 累加的结果

pro 文件里写了

CONFIG (release, debug|release) {
message("release")
#DEFINES += QT_NO_DEBUG_OUTPUT
}

release 下运行,第一次运行,会打印,循环打印,并且打印和文件得到值,19344
release 下运行,第二次 解开注释 DEFINES += QT_NO_DEBUG_OUTPUT ,不会打印,文件里得到值 11678307
release 下运行,第三次 再注释回 DEFINES += QT_NO_DEBUG_OUTPUT,然后把循环里的qDebug() 手动注释掉,打印和文件得到值 11926747

from beslyric-for-x.

BensonLaur avatar BensonLaur commented on July 22, 2024

然后实际运行 B4X 播放一首歌,什么都不做,CPU 稳定在 4.64 附近

接着,因为播放过程只有下面那一句在高频度打印,所以注释掉下面代码中的打印代码
https://github.com/Beslyric-for-X/Beslyric-for-X/blob/8c70c35118771374539570e71228e82df71705e0/BottomWidgets/BottomWidget.cpp#L280-L288

注释后 ,运行软件播放同一首歌,CPU 稳定值在 4.55 附近

from beslyric-for-x.

BensonLaur avatar BensonLaur commented on July 22, 2024

考虑到release 也要打印,所以还是可以保留 release 下的打印输出,然后注释掉那一行高频打印的代码:
https://github.com/Beslyric-for-X/Beslyric-for-X/blob/8c70c35118771374539570e71228e82df71705e0/BottomWidgets/BottomWidget.cpp#L284

from beslyric-for-x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.