新的Qt Quick编译器-让QML以接近本地应用的速度运行

The new Qt Quick Compiler - get QML to run at a speed close to native

新的Qt Quick编译器-让QML以接近本地应用的速度运行

Friday January 14, 2022 by Vladimir Minenko | Comments

2022年1月14日星期五 Vladimir Minenko | 评论

As most of you know, QML is an interpreted language. The flexibility of any interpreted language always comes with a potential decrease in performance. As we are very convinced of many other potentials of QML, we strive to reduce - if not to completely eliminate - this unpleasant potential. We implemented changes in the last Qt5 releases and especially in Qt6 helping to take a significant step towards our long term goal: make QML run at a speed close to native. This blog post explains what is new. The upcoming two blog post will elaborate the technology and its development history.

你们大多数人都知道,QML是一种解释语言。任何解释语言的灵活性总是伴随着性能的潜在下降。由于我们非常相信QML的许多其他潜力,我们努力减少——如果不是完全消除——这种不愉快的潜力。我们在上一个Qt5版本中实施了更改,特别是在Qt6中,这有助于朝着我们的长期目标迈出重要的一步:使QML以接近本地应用的速度运行。这篇博客文章阐述了新的变化。即将发布的两篇博文将详细阐述这项技术及其发展历史。

QML speed-up-1


Today, we are proud to announce that we will introduce the new Qt Quick Compiler™ with Qt 6.3. The new Qt Quick Compiler will consist of two components: the QML Type Compiler and QML Script Compiler. The QML Type Compiler will compile QML object structures into C++ classes. The QML Script Compiler will compile functions and expressions in QML files of an application into C++ code. As much as possible, since there will be some limits set by the nature of JavaScript. If certain statements cannot be compiled, regular interpretation and caching will be used. Some changes in the code of the application might be needed to achieve the best possible results over time. New QML tools will help you detect these. For example, the new QML Lint, for example, will tell you which parts of the code cause fallbacks into interpretation. We will expand and improve QML tools in the future in our aim of making them a guide to Best Practices for all components in Qt Quick. The closer you follow the recommendations reported by these tools, the more QML code can be compiled and, thus, run faster. Speaking of "faster": one of the future blog posts will also show the first benchmark results.
今天,我们自豪地宣布,我们将为Qt6.3推出新的Qt Quick编译器™。新的Qt Quick编译器将由两个组件组成:QML类型编译器和QML脚本编译器。QML类型编译器将QML对象结构编译成C++类。QML脚本编译器将编译应用程序的QML文件中的函数和表达式,转换成C++代码。尽可能多地转换,因为JavaScript的性质会设置一些限制。如果某些语句无法编译,将使用常规解释和缓存。随着时间的推移,可能需要对应用程序的代码进行一些更改,以获得尽可能好的结果。新的QML工具将帮助您检测这些。例如,新的QML Lint将告诉您代码的哪些部分会导致回退到解释中。我们将在未来扩展和改进QML工具,以使其成为Qt Quick中所有组件的最佳实践指南。您越接近这些工具报告的建议,就可以编译更多的QML代码,从而运行得更快。说到“更快”:未来的一篇博客文章也将显示第一个基准测试结果。

As an initial step we are providing a Technology Preview of the QML Script Compiler for commercial customers. It is available as of today in the "Qt for Device Creation" package released with Qt 6.2.1. This Technology Preview will continue in 6.2.x releases of "Qt for Device Creation". Starting with Qt 6.3, the base components of the Qt Quick Compiler will also be integrated in the QtDeclarative module. This is an important step for us to ensure the creation of better and faster QML code by all users in the Qt community. While the QML Script Compiler might pass its Technology Preview already in 6.3, the Technology Preview for the QML Type Compiler will only start with 6.3. Depending on the results of these preview phases, we will later decide about a first general release.

作为第一步,我们将为商业客户提供QML脚本编译器的技术预览。从今天起,Qt 6.2.1发布的“Qt for Device Creation”软件包中提供了它。此技术预览将在Qt6.2x版中继续。从Qt6.3开始,QtQuick编译器的基本组件也将集成到QtDeclarative模块中。这对于我们来说是一个重要的步骤,以确保Qt社区中的所有用户都能创建更好更快的QML代码。虽然QML脚本编译器可能已经通过了6.3中的技术预览,但QML类型编译器的技术预览将仅从6.3开始。根据这些预览阶段的结果,我们将在稍后决定第一个通用版本。

Starting with Qt 6.3, we will make Qt Quick Compiler Extensions available for Qt commercial users. Qt Quick Compiler Extensions will decrease the refactoring effort to improve coverage of compilation. Qt Quick Compiler Extensions are also planned to offer additional tooling or integrations for existing tools meant to provide a better understanding of how specific parts of the code influence execution performance of the application in the project and which changes in the code are needed to make these parts compile. More extensions are in development. In total, we expect that up to 30% speed-up can be achieved in the startup and execution over time.

从Qt6.3开始,我们将为Qt商业用户提供Qt Quick编译器扩展。Qt Quick编译器扩展将减少重构工作,以提高编译的覆盖率。Qt Quick编译器扩展还计划为现有工具提供额外的工具或集成,以便更好地了解代码的特定部分如何影响项目中应用程序的执行性能,以及需要对代码进行哪些更改才能编译这些部分。更多的扩展正在开发中。总的来说,我们希望随着时间的推移,在启动和执行过程中可以实现高达30%的速度提升。

Any compiler needs code to work with. This is the only way to evolve and get better and better, faster and faster. Please reach out to us! Ideally, via Qt Bug Reports and with samples of code which you expected to compile. The relevant component on the "QTBUG" project is "QML: Compiler". 

​任何编译器都需要使用代码。这是进化和变得越来越好、越来越快的唯一途径。请联系我们!理想情况下,通过Qt错误报告和您希望编译的代码示例。“QTBUG”项目的相关组件是“QML:Compiler”。 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值