qt5.9支持linux,科学网—Qt5.9发布了,Qt 5.9长期支持版之性能改善 - 陈德鹏的博文...

本文主要是介绍qt5.9支持linux,科学网—Qt5.9发布了,Qt 5.9长期支持版之性能改善 - 陈德鹏的博文...,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

PerformanceImprovements with Qt 5.9 LTS

Qt5.9长期支持版之性能改善

Qt 5.9 LTS improves Qt Quick and QMLperformance significantly, especially with Linux on ARM. We have worked hard toimprove the performance in multiple areas: within the QML engine, Qt Quickgraphics, QML Compiler and in the Qt Quick Controls, to name some examples.Performance has improved significantly across all areas, with some items beingseveral times faster than with our previous long-term supported release Qt 5.6LTS.

显著改善了Qt Quick 和 QML之性能,尤其在ARM平台上之Linux。QML引擎,Qt Quick 图形,Qt QML编译器,Qt Quick 控件,相对于5.6,有些方面的性能提高了数倍。

Weare regularly running several different kinds of performance tests to see howthe various optimizations work across different platforms. Some of theseresults are visible at testsresults.qt.io,while some tests have not been automated yet. Whenever possible, we areaiming to optimize the performance of all supported operating systems and CPUarchitectures. For readability and because Linux on ARM has been an area ofparticular focus with Qt 5.9 LTS, it is the one discussed in this post.Typically, the other platforms have received roughly similar improvements.

测试了不同平台,有些结果于网站testsresults.qt.io可见,重点关注ARM平台上之LINUX优化,其它平台已得到了类似改善。

Qt Quick Application StartupTime

68c2f7ba343990cc30fc06cf9d628461.pngStartup time of a QtQuick application is often critical in the embedded space. This is truefor small single-process embedded systems, as well as for more complexmulti-process devices. We have offered a commercial-only tool called the QtQuick Compiler since Qt 5.3 to improve the startup time by leveraging the C++compiler to compile QML into a normal C++ binary(利用CPP编译器把QML编译为普通的CPP二进制文件). Between Qt 5.6 LTS and Qt 5.9LTS, the performance of the QML engine has improved with each new Qt release(Qt5.6~5.9之间,每一次发布,QML引擎均得到改善), resulting in improved application startup time. Qt 5.8 introducedQML caching(引入了QML缓存机制), whichmakes second and subsequent runs of the applications to be faster(使得第二次和后续应用程序运行更快). Qt 5.9 also offers a possibility to pre-populate the cache (预填充缓存机制来对已运行一次的应用改善性能)to reach improved performance already with the first run. With theQt Quick Compiler, the first run is also already fast(使用Qt Quick Compiler第一次运行也已变得更快。).(下面的图例,注意是越短标识性能越高)

64位ARM总是比32位性能好很多,值得关注的是64bit ARM硬件平台为NVIDIA TX1 Linux。

方法为通过编译器把

Eachapplication has unique characteristics so the exact benefit in startup time forusing Qt 5.9 LTS and/or the Qt Quick Compiler will vary. Typically, the moreQML used, the bigger the improvement is(QML用得越多,性能改善越大).In Qt 5.9 LTS we offer two alternative options(两种改善机制选项): the commercial-only Qt Quick Compiler (一种仅对商业化的Qt Quick Compiler)and a new tool to populatethe cache ahead-of-time(一个新工具来提前填充缓存), which isavailable for both open-source and commercial users.(这对开源和商业用户均可用) The performance and reduced startup time are in practice the samewith both approaches in Qt 5.9 LTS(在Qt 5.9LTS中两种方法的性能改善在实践中是相同的。).

Whencomparing the startup time for the same Qt Quick application with Qt 5.6LTS without the Qt Quick Compiler to the startup time of Qt 5.9 LTS using theQt Quick Compiler (or populated cache), the improvement is a whopping 60% onNXP i.MX6(对NXPi.MX6CPU 启动时间性能提高了60%). Whenusing the commercial-only Qt Quick Compiler of Qt 5.6 LTS the improvement instartup time is 54% (compared to Qt 5.6 LTS without the Qt Quick Compiler inuse)(带商业化Qt Quick Compiler相对于不带的Qt 5.6 LTS,启动性能提升了54%). Comparing the startup times of Qt 5.6 LTS and Qt 5.9 LTS when bothare using the Qt Quick Compiler the improvement is 14% on NXP i.MX6(都使用Qt Quick Compiler的5.6对5.9,性能提升了14%,对NXPi.MX6).

Theapplication used for the tests was the Qt Quick Controls 1 gallery and thetests were run with Linux on NXP i.MX6 and NVIDIA Tegra X1. We used theControls 1 example because they are much heavier than Controls 2, thus betterresembling a typical real-life Qt Quick application. For more measurements ofQt Quick application startup times, please check out the earlier blog post.For instructions to further optimize startup time of a Qt Quick application,please read the second post of ourearlier fastboot blog series.

用于测试的应用是Qt Quick Controls 1,测试平台为Linux on NXP i.MX6and NVIDIA Tegra X1。

Qt Quick ControlsPerformance

Qt5.6 LTS features Qt Quick Controls 1 whileQt 5.9 LTS features the Qt QuickControls 2fullysupported. The main design principle ofQt Quick Controls 2has beenperformance, as can be seen already from the blog post announcingthem. From the very beginning,the key focus areaof the newQt Quick Controls 2 has been for embeddeddevices and systems.However, these can equally well be used on all supported platforms.Compared to Qt Widgets or Qt Quick Controls 1, the key difference of Qt QuickControls 2 is that they do not adapt to platform style. We do offer multipledifferent styles for Qt Quick Controls 2 and it is easy to make your own styleas well. From an architectural viewpoint, the key difference of Qt QuickControls 2 is that they leverage C++ for everything that can be done with C++and offer just the QML API for applications to use.

Qt QuickControls 2特别强调性能,关键关注领域为嵌入式设备和系统。相对于Qt Widgets or Qt QuickControls 1,它不是适应平台式样风格,而是提供多种风格式样Qt Quick Controls 2,容易创建自己的式样风格。从架构的观点来看,QtQuick Controls 2的关键不同点为对每一项能用C++的都利用C++来处理,仅为应用提供QMLAPI供其使用。

2bdcb5be45364d0d3f6b66baf2a717d9.png

Asillustrated in the graph above, the performance improvement is huge (note: thehigher the bar, the better the performance is). We used NXP i.MX6 running Linuxfor the measurements. For some of the controls the performance is 14xbetter than before(最高性能高14倍), and on average the performance hasbeen improved 6x comparing Qt 5.9 LTS with Qt Quick Controls 2 to Qt 5.6 LTSwith Qt Quick Controls 1(平均性能提高6倍). To benefit from the improved performance, the application needs tobe ported to use Qt Quick Controls 2. This is typically quite straightforward (这往往十分简单)and Qt Quick Controls 2 offers most of the common controls(提供了绝大多数控件). Before porting, please check the documentation,as some controls, such as TableView, are not currently available with Qt QuickControls 2(移植前,请查看文档,诸如TableView的一些控件,在Qt Quick Controls 2中当前是不可用的。).

Shader Cache着色器缓冲

Qt5.9 LTS introduces a new feature to cache OpenGL shaders to disk after thefirst run(引入了一个新特性,在第一次运行后,缓冲OpenGL 着色器), as explained in the blog post introducingthe shader cache. If your Qt Quick application is using OpenGLshaders, which is quite often the case这是常遇见的情形, itwill achieve a significant improvement in startup time comparedto earlier versions of Qt. When comparing the performance of Qt 5.6 LTS toQt 5.9 LTS using the same Qt Quick application with 10 shaders十个着色器, we can see a significant improvement in the initialization time ofthe shaders(着色器初始化时间). Some of the performanceimprovement observed in the measurement is due to the overall improvements inthe graphics performance, but most of the improvement can be attributedto the new shader cache feature.

e9de03ad0175a35c8a54ca2412df2097.png

Qt5.9 LTS is a whopping 7x faster than Qt 5.6 LTS on startup with the same exactQt Quick application running the same hardware(同样硬件和Qt Quick应用,快乐7倍。). Just like the previous measurementsdescribed in the blog post, this test has also been conducted usingNXP i.MX6 running Linux. The performance improvement is dependent on thehardware and especially the GPU plays a major role(性能的改善依赖于硬件,尤其是GPU扮演主要角色). Based on our measurements thereare significant improvements with every piece of hardware we have tested –including ones that implement cache feature already in the OpenGL driver.

Memory Footprint(足印;占用空间;占地面积) Improvements 内存占用改善

In Qt5.8 we introduced a new configuration system and made other improvementsto reduce the binary size of the Qt framework libraries usedfor different applications(5.8中引入新的配置系统减少Qt框架库的二进制代码大小). This was developed as part of the Qt Lite project, which focusedspecifically on reducing the application size(特别关注减少应用程序是大小). With Qt 5.9 LTS we have further polished and tuned the availableconfigurations so that more and more different kinds of applications can reachtheir minimal Qt configuration(5.9中可达到最小之配置). Reducing the size of a Qt 5.6 LTS application is possible mainlyby just using the modules needed by the application and statically linking thebinary(5.6中主要使用为应用仅使用必要之模块,以及链接为静态二进制库). Because of dependencies within the Qt framework, the linker is notable to reach as small binary size as it is possible with Qt 5.9 LTS using thenew configuration tool.

由于Qt框架的依赖性,连接器不可能达到最小二进制程序大小。5.9使用了新配置工具

02b2e1b97b7c9b4a50451fa1dd0b8999.png

Weused a simple, but non-trivial, Qt Quick application (samegame) tocompare the needed binary size of the application itself as well as all the Qtlibraries it needs. With Qt 5.6 LTS the application requires 24,5MB whenlinking dynamically. Using static linking, the size is reduced to 13,8MB(still using Qt 5.6 LTS). Leveraging the new configuration tool in Qt 5.9LTS and with other Qt Lite improvements, the exact same application only needs5,4MB when static linking is used. Percentage-wise, the Qt 5.9 LTS binary sizeof the application is 61% smaller than the same application with Qt 5.6 LTS andstatic linking – without losing any functionality or making any changesto the application.(厉害了,我的Qt5.9)

Improvement in JavaScriptPerformance JavaScript性能之改善

Withthe improvements in the QML engine in Qt 5.9 LTS the performance of JavaScriptexecution has also improved(QML 引擎的改善,同时JavaScript的执行性能亦得到改善). If the Qt Quickapplication leverages JavaScript, there is a huge improvement in performancecompared to Qt 5.6 LTS, especially on 64-bit ARM. One example of heavilyleveraging JavaScript is using three.js on top of Canvas 3D, and smalleramounts of JavaScript are often used in Qt Quick applications.尤其是对64位AMR平台,如果Qt Quick应用利用了JavaScript,性能改善明显。

.Comparison.png

Themeasurements are done with v8-bench, which can be found in the qtdeclarativerepository. Additional measurements are available at testresults.qt.io.With the v8-bench performance benchmark results of Qt 5.6 LTS compared to Qt5.9 LTS, the improvement on 32-bit ARM is 16%(32位ARM提升16%), but on 64-bit ARM the improvement is awhopping 302% (i.e. 4x improvement)(64位ARM提升302%). Thereasons for the huge improvements are that Qt 5.9 LTS fully supports64-bit ARM processors combined with the improvements in the QML engine.巨大改善之原因为Qt 5.9 LTS完全支持64bitARMCPU,结合QML引擎之改善。

Overall Qt Quick PerformanceImprovements全面Qt Quick 性能之改善

qmlbench_example.pngThe examples above arejust some of the highlights from many improvements we have done to theperformance of Qt Quick in Qt 5.9 LTS. We have tuned multiple individual areasand optimized the execution paths within the Qt framework. It is important tonote that we have also worked hard not to regress(后退,回归,退化) in any areas. To avoidregressions, we are regularly running a comprehensive Qt Quick benchmark suitecalled Qmlbench. With the Qmlbench tool we can see the performance of the mostcommonly used Qt Quick functionality as well as the functionality thatis used less frequently. For more details, please review the thorough explanationof how we are using Qmlbench to avoid regressions.

Whencomparing Qt 5.6 LTS and Qt 5.9 LTS in the same environment with thecomprehensive Qmlbench measurements, we can see  that some areas improvedup to 130% as shown in the graph above. Especially layout and complex textperformance has improved drastically尤其在布局和复杂文本性能的改善显著. The average improvement ofQt 5.9 LTS compared to Qt 5.6 LTS in all Qmlbench tests is 14% (measured onLinux)改善性能,基于Qmlbench测试,平均改善14%.Despite which functionality is used, the improvement in performance of a QtQuick application running Qt 5.9 LTS compared to Qt 5.6 LTS is clear andtangible for most applications.

Conclusions

Inthis blog post在本博客帖子中, I summarized some of the multiple performance improvementsavailable with Qt 5.9 LTS. Compared to Qt 5.6 LTS, the performance of the sameapplication running on Qt 5.9 LTS is significantly higher. Without making anychanges to the application, except for compiling it for the new Qt 5.9 LTS, theperformance is significantly improved. Ranging from improved applicationstartup time and smaller footprint through to increased graphicsperformance, Qt 5.9 LTS is a major step forward performance-wise. Taking someof the new features, such as Qt Quick Controls 2, into use even furthers theperformance improvements available with Qt 5.9 LTS.

Interestedin taking a closer look? Qt 5.9.0 has been released today. You can get it withyour online installer, from the Qt Account orfrom the Qt Downloads page (foropen-source users).

Formore details of Qt 5.9 LTS, please check the Qt 5.9 LTS releaseblog post.

转载本文请联系原作者获取授权,同时请注明本文来自陈德鹏科学网博客。

链接地址:http://blog.sciencenet.cn/blog-338872-1058803.html

上一篇:url inverse problem source code cpp

下一篇:Qt Creator 4.4.0 released 发布了。。。。。您值得关注。。...

这篇关于qt5.9支持linux,科学网—Qt5.9发布了,Qt 5.9长期支持版之性能改善 - 陈德鹏的博文...的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/363678

相关文章

Linux线程同步/互斥过程详解

《Linux线程同步/互斥过程详解》文章讲解多线程并发访问导致竞态条件,需通过互斥锁、原子操作和条件变量实现线程安全与同步,分析死锁条件及避免方法,并介绍RAII封装技术提升资源管理效率... 目录01. 资源共享问题1.1 多线程并发访问1.2 临界区与临界资源1.3 锁的引入02. 多线程案例2.1 为

Oracle数据库定时备份脚本方式(Linux)

《Oracle数据库定时备份脚本方式(Linux)》文章介绍Oracle数据库自动备份方案,包含主机备份传输与备机解压导入流程,强调需提前全量删除原库数据避免报错,并需配置无密传输、定时任务及验证脚本... 目录说明主机脚本备机上自动导库脚本整个自动备份oracle数据库的过程(建议全程用root用户)总结

Linux如何查看文件权限的命令

《Linux如何查看文件权限的命令》Linux中使用ls-R命令递归查看指定目录及子目录下所有文件和文件夹的权限信息,以列表形式展示权限位、所有者、组等详细内容... 目录linux China编程查看文件权限命令输出结果示例这里是查看tomcat文件夹总结Linux 查看文件权限命令ls -l 文件或文件夹

idea的终端(Terminal)cmd的命令换成linux的命令详解

《idea的终端(Terminal)cmd的命令换成linux的命令详解》本文介绍IDEA配置Git的步骤:安装Git、修改终端设置并重启IDEA,强调顺序,作为个人经验分享,希望提供参考并支持脚本之... 目录一编程、设置前二、前置条件三、android设置四、设置后总结一、php设置前二、前置条件

Linux系统中查询JDK安装目录的几种常用方法

《Linux系统中查询JDK安装目录的几种常用方法》:本文主要介绍Linux系统中查询JDK安装目录的几种常用方法,方法分别是通过update-alternatives、Java命令、环境变量及目... 目录方法 1:通过update-alternatives查询(推荐)方法 2:检查所有已安装的 JDK方

Linux系统之lvcreate命令使用解读

《Linux系统之lvcreate命令使用解读》lvcreate是LVM中创建逻辑卷的核心命令,支持线性、条带化、RAID、镜像、快照、瘦池和缓存池等多种类型,实现灵活存储资源管理,需注意空间分配、R... 目录lvcreate命令详解一、命令概述二、语法格式三、核心功能四、选项详解五、使用示例1. 创建逻

Linux下在线安装启动VNC教程

《Linux下在线安装启动VNC教程》本文指导在CentOS7上在线安装VNC,包含安装、配置密码、启动/停止、清理重启步骤及注意事项,强调需安装VNC桌面以避免黑屏,并解决端口冲突和目录权限问题... 目录描述安装VNC安装 VNC 桌面可能遇到的问题总结描js述linux中的VNC就类似于Window

linux下shell脚本启动jar包实现过程

《linux下shell脚本启动jar包实现过程》确保APP_NAME和LOG_FILE位于目录内,首次启动前需手动创建log文件夹,否则报错,此为个人经验,供参考,欢迎支持脚本之家... 目录linux下shell脚本启动jar包样例1样例2总结linux下shell脚本启动jar包样例1#!/bin

Linux之platform平台设备驱动详解

《Linux之platform平台设备驱动详解》Linux设备驱动模型中,Platform总线作为虚拟总线统一管理无物理总线依赖的嵌入式设备,通过platform_driver和platform_de... 目录platform驱动注册platform设备注册设备树Platform驱动和设备的关系总结在 l

linux批量替换文件内容的实现方式

《linux批量替换文件内容的实现方式》本文总结了Linux中批量替换文件内容的几种方法,包括使用sed替换文件夹内所有文件、单个文件内容及逐行字符串,强调使用反引号和绝对路径,并分享个人经验供参考... 目录一、linux批量替换文件内容 二、替换文件内所有匹配的字符串 三、替换每一行中全部str1为st