![Qml應(yīng)用性能優(yōu)化ppt課件_第1頁](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頁](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頁](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頁](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頁](http://file3.renrendoc.com/fileroot_temp3/2022-1/24/afa6a0c3-befa-41f5-bad5-63196b84ae85/afa6a0c3-befa-41f5-bad5-63196b84ae855.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(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ù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)過import方式引入進(jìn)來的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. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 釀酒廠天然氣供氣服務(wù)合同
- 物聯(lián)網(wǎng)工程居間合同
- 農(nóng)業(yè)政策支持方案
- 補(bǔ)充借款合同格式
- 新媒體運(yùn)營(yíng)合作協(xié)議
- 林木種植與林業(yè)管理作業(yè)指導(dǎo)書
- 大型鉆機(jī)租賃合同
- 大廈物業(yè)租賃合同
- 小學(xué)二年級(jí)數(shù)學(xué)上冊(cè)口算題卡
- 2025年漢中貨運(yùn)上崗證模擬考試試題
- 監(jiān)理專題安全例會(huì)紀(jì)要(3篇)
- GB/T 17374-2024食用植物油銷售包裝
- 高級(jí)煙草制品購(gòu)銷員(三級(jí))職業(yè)資格鑒定理論考試題及答案
- 河道清淤疏浚投標(biāo)方案(技術(shù)方案)
- 護(hù)理部工作總結(jié)
- 2017年湖北省黃岡市中考語文(有解析)
- 中國(guó)水利水電第十二工程局有限公司招聘筆試真題2023
- DB37-T3953-2020醫(yī)療衛(wèi)生機(jī)構(gòu)安全風(fēng)險(xiǎn)分級(jí)管控體系實(shí)施指南
- 工業(yè)機(jī)器人系統(tǒng)運(yùn)維員(中級(jí))課件全套 宋永昌 項(xiàng)目1-3 機(jī)械系統(tǒng)檢查與診斷-工業(yè)機(jī)器人運(yùn)行維護(hù)與保養(yǎng)
- 浩順一卡通軟件新版說明書
- 2024年高考英語新課標(biāo)1卷講評(píng)(七選五+完形填空+語法填空)-2025屆高三英語一輪復(fù)習(xí)
評(píng)論
0/150
提交評(píng)論