![Qml應(yīng)用性能優(yōu)化ppt課件_第1頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-1/24/afa6a0c3-befa-41f5-bad5-63196b84ae85/afa6a0c3-befa-41f5-bad5-63196b84ae851.gif)
![Qml應(yīng)用性能優(yōu)化ppt課件_第2頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-1/24/afa6a0c3-befa-41f5-bad5-63196b84ae85/afa6a0c3-befa-41f5-bad5-63196b84ae852.gif)
![Qml應(yīng)用性能優(yōu)化ppt課件_第3頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-1/24/afa6a0c3-befa-41f5-bad5-63196b84ae85/afa6a0c3-befa-41f5-bad5-63196b84ae853.gif)
![Qml應(yīng)用性能優(yōu)化ppt課件_第4頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-1/24/afa6a0c3-befa-41f5-bad5-63196b84ae85/afa6a0c3-befa-41f5-bad5-63196b84ae854.gif)
![Qml應(yīng)用性能優(yōu)化ppt課件_第5頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-1/24/afa6a0c3-befa-41f5-bad5-63196b84ae85/afa6a0c3-befa-41f5-bad5-63196b84ae855.gif)
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Qml運(yùn)用性能優(yōu)化;QML的執(zhí)行 QML的編譯 QML的執(zhí)行、實(shí)例化 QML的渲染QML的編譯QML的執(zhí)行、實(shí)例化QML的顯示setSourceApp.exec;QML的設(shè)計(jì)思想 QML運(yùn)用在啟動(dòng)時(shí),會(huì)對(duì)qml進(jìn)展編譯,并且對(duì)一切元素進(jìn)展實(shí)例化 比如顯示一個(gè)Button : id.visiable=true QML不是一個(gè)傳統(tǒng)的解釋型言語(yǔ),運(yùn)轉(zhuǎn)時(shí) 將一切代碼編譯 將一切代碼實(shí)例化 目的:犧牲啟動(dòng)性能,保證運(yùn)用的運(yùn)轉(zhuǎn)性能 QML的這種設(shè)計(jì),導(dǎo)致了。;QML性能分析ListMyListItem.qmlMyListItem.qmlMyListItem.qmlMyListItem.qmlMyListI
2、tem.qmlMyListItem.qmlMyListItem.qmlTextButtonCMOS_BasicDialogCMOS_BasicDialog運(yùn)用在啟動(dòng)的時(shí)候,會(huì)創(chuàng)建14個(gè)CMOS_BasicDialog,每個(gè)CMOS_BasicDialog用時(shí)20ms,總共破費(fèi)280ms;qmlprofiler 需求在運(yùn)用的.pro開啟qml debug:CONFIG += qml_debug 編輯appconfig.xml,修正運(yùn)用的啟動(dòng)項(xiàng) /usr/bin/cmoscalculator -qmljsdebugger=port:3768,block 重啟機(jī)器 點(diǎn)擊運(yùn)轉(zhuǎn)運(yùn)用 在PC端運(yùn)轉(zhuǎn)QtCr
3、eator;QML的編譯 一切經(jīng)過(guò)import方式引入進(jìn)來(lái)的qml代碼都將會(huì)被編譯 一個(gè)qml文件只會(huì)被編譯一次 Qml文件會(huì)被編譯成為特定的字節(jié)碼;控制QML的編譯 將QML文件分到多個(gè)不同的QML文件 采用動(dòng)態(tài)創(chuàng)建QML組件的方式;QML實(shí)例化 一切元素在運(yùn)轉(zhuǎn)前都會(huì)被實(shí)例化 內(nèi)存占用很高 運(yùn)用的啟動(dòng)速度很慢 優(yōu)化戰(zhàn)略:用到的時(shí)候才需求實(shí)例化 采用Qt.createComponent()的方式,動(dòng)態(tài)創(chuàng)建qml組件;三種不同的寫法不編譯、不實(shí)例化Qt.createComponent(“qrc:/qml/Alarm/AlarmMain.qml)只編譯,不實(shí)例化Component Item CMO
4、S_PageStackWindow CMOS_BasicDialog CMOS_LineEdit 編譯且實(shí)例化 Tab id :alarm ;異步Loader 本身并不節(jié)省時(shí)間 可以添加并行效果 可以在總時(shí)間不變的情況下,提高用戶體驗(yàn);性能優(yōu)化 Do it faster Do it in parallel Do it later Dont do it at all Do it before;QML的優(yōu)化技巧 Text Element Image Controlling Element Lifetime Render /doc/qt-5/qtquick-perform
5、ance.html;Text Element PlainText StyledText AutoText RichText ;ImagesAsynchronous LoadingImages are often quite large, and so it is wise to ensure that loading an image doesnt block the UI thread. Set the asynchronous property of the QML Image element to true to enable asynchronous loading of images
6、 from the local file system Explicit Source SizeIf your application loads a large image but displays it in a small-sized element, set the sourceSize property to the size of the element being rendered to ensure that the smaller-scaled version of the image is kept in memory, rather than the large one.
7、;Controlling Element Lifetime Lazy Initialization there is no better way to reduce startup time than to avoid doing work you dont need to do, and delaying the work until it is necessary. Using Loader Using the active property of a Loader, initialization can be delayed until required. Using the overl
8、oaded version of the setSource() function, initial property values can be supplied. Setting the Loader asynchronous property to true may also improve fluidity while a component is instantiated.;Controlling Element LifetimeUsing Dynamic CreationDevelopers can use the Qt.createComponent() function to
9、create a component dynamically at runtime from within JavaScript, and then call createObject() to instantiate it.Destroy Unused ElementsElements which are invisible because they are a child of a non-visible element (for example, the second tab in a tab-widget, while the first tab is shown) should be
10、 initialized lazily in most cases, and deleted when no longer in use, to avoid the ongoing cost of leaving them active (for example, rendering, animations, property binding evaluation, etc).An item loaded with a Loader element may be released by resetting the source or sourceComponent property of th
11、e Loader, while other items may be explicitly released by calling destroy() on them. In some cases, it may be necessary to leave the item active, in which case it should be made invisible at the very least.;RenderOver-drawing and Invisible ElementsIf you have elements which are totally covered by ot
12、her (opaque) elements, it is best to set their visible property to false or they will be drawn needlessly.Translucent vs OpaqueOpaque content is generally a lot faster to draw than translucent. The reason being that translucent content needs blending and that the renderer can potentially optimize op
13、aque content better.ShaderWhen deploying to low-end hardware and the shader is covering a large amount of pixels, one should keep the fragment shader to a few instructions to avoid poor performance.;文件管理器的優(yōu)化FileEditBar.qml CMOS_BasicDialog id:deleteConfirmDialog CMOS_BasicDialog id:renameDialog CMOS
14、_BasicDialog id:progressDialog 兩種優(yōu)化方法 動(dòng)態(tài)創(chuàng)建 Re-use existing components;運(yùn)用啟動(dòng)的優(yōu)化 生成Image時(shí),運(yùn)轉(zhuǎn)prelink 運(yùn)用Booster機(jī)制 進(jìn)展CPU調(diào)頻 調(diào)整運(yùn)用的啟動(dòng)效果 發(fā)布Release版本;Booster的機(jī)制mapplauncherBoosterinvokerFork一個(gè)進(jìn)程Preload preload.qml啟動(dòng)進(jìn)程命令Booster加載進(jìn)程重命名進(jìn)程,繼續(xù)加載對(duì)應(yīng)QML;對(duì)Booster的優(yōu)化 優(yōu)化前 CMOS_PageStackWindow CMOS_BasicDialog CMOS_LineEdit CMOS_ListView CMOS_TabView CMOS_Page 優(yōu)化后Item Component Item CMOS_PageStackWindow CMOS_BasicDialog CMOS_LineEdi
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 制作宣傳海報(bào)合同范本
- 2014網(wǎng)簽合同范本
- 勞務(wù)合同范例重寫
- 2025年度客運(yùn)站旅客信息服務(wù)系統(tǒng)升級(jí)合同
- 保證合同范例 博客
- 農(nóng)村保姆協(xié)議合同范本
- 深化教育改革與人才培養(yǎng)質(zhì)量提升并行
- 分公司 保證合同范例
- 村計(jì)生專干申請(qǐng)書
- otc藥品銷售合同范本
- 2024年高考英語(yǔ)新課標(biāo)1卷講評(píng)(七選五+完形填空+語(yǔ)法填空)-2025屆高三英語(yǔ)一輪復(fù)習(xí)
- 植物檢疫員崗位職責(zé)說(shuō)明書
- 2023~2024學(xué)年二年級(jí)下冊(cè)語(yǔ)文期末??荚嚲怼?chuàng)意情境 統(tǒng)編版
- 2024年高考?xì)v史總復(fù)習(xí)中外歷史大事年表
- 經(jīng)理層年度任期經(jīng)營(yíng)業(yè)績(jī)考核及薪酬辦法
- 2024年高考英語(yǔ)新聞報(bào)道閱讀理解訓(xùn)練歷年真題
- 行政倫理學(xué)教程(第四版)課件 第1章 行政倫理的基本觀念
- 項(xiàng)目評(píng)分表范表
- 管網(wǎng)改造工程施工組織設(shè)計(jì)
- 社區(qū)老年人日間照料中心運(yùn)營(yíng)老年人日間照料服務(wù)方案
- 變電站土建安全培訓(xùn)
評(píng)論
0/150
提交評(píng)論