我最近发布了一个关于 QObject 在典型使用场景中的开销的问题,但不幸的是,该问题与另一个在技术上没有回答问题的问题重复.
I recently posted a question about the overhead of QObject in typical usage scenarios, but unfortunately the question got closed as a duplicate of another question that didn't technically answer the question.
更糟糕的是,礼貌地冲过去结束我的问题的仓促的撒玛利亚人"打断了我在运行了几次测试后刚刚完成打字的答案.由于我无法再在原始问题中发布我的发现,我将其发布在这里,以便其他可能需要该信息的人可以使用.
What is worse, the hasty "Samaritans" who politely rushed to close my question interrupted the answer I was just finishing typing after running a few tests. Since I can no longer post my findings in my original question, I'll post it here so it is available to others who might need that information.
很多人都暗示 QObject 很重,但并不清楚它到底有多重.所以我做了一些测量,不是很准确,所有数值都是近似值.
A lot of people have hinted at QObject being heavy, but without any clarity on how heavy is it exactly. So I did some measurements, not very accurate, all values are approximate.
这些数字应该考虑到我使用的是 64 位 Qt 版本.
Those numbers should take into account I am using a 64 bit Qt build.
所以,总而言之,QObject 的开销确实相当大.没有什么可以打喷嚏或过度使用.
So, in conclusion, the overhead of QObject is quite significant indeed. Nothing to sneeze at or overuse.
这篇关于QObject 到底有多重?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何在 C++ 中读取和操作 CSV 文件数据?How can I read and manipulate CSV file data in C++?(如何在 C++ 中读取和操作 CSV 文件数据?)
在 C++ 中,为什么我不能像这样编写 for() 循环:In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,为什么我不能像这样编写 for() 循环: for(
OpenMP 如何处理嵌套循环?How does OpenMP handle nested loops?(OpenMP 如何处理嵌套循环?)
在循环 C++ 中重用线程Reusing thread in loop c++(在循环 C++ 中重用线程)
需要精确的线程睡眠.最大 1ms 误差Precise thread sleep needed. Max 1ms error(需要精确的线程睡眠.最大 1ms 误差)
是否需要“do {...} while ()"?环形?Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?环形?)