电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

SAP UI5和React的页面渲染性能比较.docx

11页
  • 卖家[上传人]:A***
  • 文档编号:143357005
  • 上传时间:2020-08-28
  • 文档格式:DOCX
  • 文档大小:1.37MB
  • / 11 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • 1、SAP UI5和React的页面渲染性能比较I have been working as a Fiori application developer and nowadays I have read quite a lot of blogs which introduce how to build web application using React. React is an open-source JavaScript library providing a view for data rendered as HTML. You can find more information from Wikipedia and its source code from github.Most of those blogs have mentioned that React has quite good performance but dont contain detail performance data. Since I have been using SAP UI5 framework

      2、in my daily work, I am curious about the performance comparison between SAPUI5 and React regarding the topic of page rendering.Comparison environment setupI have implemented a most simple application separately via UI5 and React to measure their page rendering performance difference.The application has the following appearance: it consists of a TextField with a given numbers of TextArea. The number of TextArea is controlled via code. Every time you type something in the TextField, the text you h

      3、ave typed will be written in all of the TextField as well.The UI5 implementationI use Json view to implement this application. The source code of “sample.view.js” has been listed below. The variable “_NUMBER” controls the number of TextAreas.sap.ui.jsview(compareReact.sample, _NUMBER: 100,_textAreas: ,getControllerName : function() return compareReact.sample;,createContent : function(oController) var that = this; var oInput1 = new mons.TextField(input1); oInput1.setValue(Hello!); oInput1.attachL

      4、iveChange(function(event) / console.log(Text changed to :+ oInput1.getValue(); for( var i = 0; i that._NUMBER; i+) that._textAreasi.setValue(event.getParameter(liveValue); ); this.oLayout = new sap.ui.layout.VerticalLayout(Layout1, content:oInput1 ); for( var i = 0; i this._NUMBER; i+) var oInput = new mons.TextArea(text + i); this.oLayout.addContent(oInput); this._textAreas.push(oInput); return this.oLayout;);The React implementationFor those who are not familiar with React, let me briefly intr

      5、oduce this source code:When I studied React for the first time, I was confused by the “syntax error” for example in line 28 and 3236. Actually this is the supported syntax on script tag with type “text/babel” ( in line 10 ). Using this JSX grammar, it is allowed to insert native HTML markup into JavaScript code.And keep in mind, such JSX code will be translated to native JavaScript when the page is rendered, by browser.min.js. For steps how to get and debug converted JavaScript source code, plea

      6、se refer to my blog How to get and debug converted source code in React.In line 12, a customized ReactComponent is created which encapsulates the logic how the view should be rendered and what is the data source of this view. For me, I would like to treat the function render() as createContent() in SAPUI5 Json view, andsetState() as the ClientModel handling in SAPUI5. You see the line 33 “value=value” and shouldnt this be the same logic as SAPUI5 data binding?When there is live-change event occu

      7、rred, the callback function “this.handleChange” specified in line 33 will be called, which will then trigger ReactComponent.setState and finally render() will be called to refresh the page.The created ReactComponent could be used the same way as native HTML tag to insert into the page.The code above has exactly the same logic as what we do in every UI5 application:Use Chrome timeline to measure performanceI will use the tab “TimeLine” to measure performance. There is already a good article intro

      8、ducing how to use this tab by Google.UI5 application resultI start comparison by specifying the number of TextArea as 100. First start UI5 application. I type “3” for six times and I get the following measurement result:(1) The six areas marked with black bold underline represent the performance data for each of the six “3” type action. As I only focus on rendering stuff, I can ignore the orange color for “Scripting”. So the total rendering time for scenario with 100 TextArea are 36.3ms and Pain

      9、ting time is 6.9ms.You might be confused by the terms “layouting”, “rendering” and “painting”? Read this awesome blog How browsers work-Behind the scenes of modern web browsers to understand their exactly meaning.And have you noticed the small red icon for “Long frame”?You can click the hyperlink “jank” to know more detail about “Long frame“.By clicking the corresponding rectangle with different color, you can get a detail view under tab “Event Log”.For example, below detail view shows that the code in line 416 of TextField.js:formatted has triggered the style recalculation which consumes 1.8ms.Click the hyperlink and we are eable to see the exact line with its context. In this case, we first get the native HTML DOM node in line 399 and fill it

      《SAP UI5和React的页面渲染性能比较.docx》由会员A***分享,可在线阅读,更多相关《SAP UI5和React的页面渲染性能比较.docx》请在金锄头文库上搜索。

      点击阅读更多内容
    最新标签
    信息化课堂中的合作学习结业作业七年级语文 发车时刻表 长途客运 入党志愿书填写模板精品 庆祝建党101周年多体裁诗歌朗诵素材汇编10篇唯一微庆祝 智能家居系统本科论文 心得感悟 雁楠中学 20230513224122 2022 公安主题党日 部编版四年级第三单元综合性学习课件 机关事务中心2022年全面依法治区工作总结及来年工作安排 入党积极分子自我推荐 世界水日ppt 关于构建更高水平的全民健身公共服务体系的意见 空气单元分析 哈里德课件 2022年乡村振兴驻村工作计划 空气教材分析 五年级下册科学教材分析 退役军人事务局季度工作总结 集装箱房合同 2021年财务报表 2022年继续教育公需课 2022年公需课 2022年日历每月一张 名词性从句在写作中的应用 局域网技术与局域网组建 施工网格 薪资体系 运维实施方案 硫酸安全技术 柔韧训练 既有居住建筑节能改造技术规程 建筑工地疫情防控 大型工程技术风险 磷酸二氢钾 2022年小学三年级语文下册教学总结例文 少儿美术-小花 2022年环保倡议书模板六篇 2022年监理辞职报告精选 2022年畅想未来记叙文精品 企业信息化建设与管理课程实验指导书范本 草房子读后感-第1篇 小数乘整数教学PPT课件人教版五年级数学上册 2022年教师个人工作计划范本-工作计划 国学小名士经典诵读电视大赛观后感诵读经典传承美德 医疗质量管理制度 2 2022年小学体育教师学期工作总结
    关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
    手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
    ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.