UI5性能参数:data-sap-ui-preload与data-sap-ui-async [英] UI5 performance parameters: data-sap-ui-preload vs. data-sap-ui-async

查看:84
本文介绍了UI5性能参数:data-sap-ui-preload与data-sap-ui-async的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不同的SAPUI5性能准则提到了两个关键参数,它们似乎具有相似的性质,但解释略有不同:

Different SAPUI5 performance guidelines mention two key parameters, which seem to have similar nature, but slightly different explanation:

  1. 数据-sap-ui-preload ="async"

此处最重要的设置是 data-sap-ui-preload ="async" .这使运行时可以为所有已声明的库加载模块在后台异步.这减少了请求数量客户端发送的邮件可能会相互阻塞.

The most important setting here is data-sap-ui-preload="async". This enables the runtime to load the modules for all declared libraries asynchronously in the background. This reduces the amount of requests sent by the client that could block each other.

  • data-sap-ui-async ="true"

    最重要的设置是 data-sap-ui-async ="true" .这使运行时以加载所有模块并为所有已声明的文件预加载文件异步库(如果使用异步API).环境 async = true 利用浏览器的功能来执行多个并行请求,而不会阻塞UI线程.

    The most important setting is data-sap-ui-async="true". This enables the runtime to load all the modules and preload files for all declared libraries asynchronously, if an asynchronous API is used. Setting async=true leverages the browser's capabilities to execute multiple requests in parallel, without blocking the UI thread.

  • 请您说明一下到底有什么区别,我什么时候应该在另一个上使用?

    Could you please clarify what exactly the difference, when should I use one over another?

    推荐答案

    第一个链接的文档基于过时的UI5版本 1.38.x .当时,配置 sap-ui-preload =" async" 确实是最重要的设置",而不是设置".因为当时没有 sap-ui-async .在版本 1.58.2 中,引入了 async ="true" ,该代码应代替声明的 preload ="true" 在主题 配置选项和URL参数 :

    The first linked documentation is based on the outdated UI5 version 1.38.x. At that time, the config sap-ui-preload="async" was indeed "the most important setting" since there was no sap-ui-async available back then. With version 1.58.2, the async="true" was introduced which should be used instead of preload="true" as stated in the topic Configuration Options and URL Parameters:

    预加载

    此配置参数定义所谓的 preload文件的加载行为.[…]值的用法如下:

    preload

    This configuration parameter defines the loading behaviour of the so-called preload files. […] The values are used as follows:

    • […]
    • 设置为 async 时,预加载文件将异步加载.但是,我们建议改为在引导程序中使用 async = true 配置参数,因为它会将更多模块/相关API切换为异步包括预加载文件的加载行为.
    • […]
    • When set to async, the preload files are loaded asynchronously. However, we recommend to use the async=true configuration parameter in the bootstrap instead, because it switches more module/related APIs to async including the loading behaviour of the preload files.

    异步

    此配置设置使模块加载程序可以异步加载模块和库预加载文件.


    TL; DR

    data-sap-ui-async="true" // since 1.58.2 --> Replaces preload="async" *
    

    data-sap-ui-preload="async" // for 1.58.1 and below
    

    *先决条件: 您的应用程序是否已准备好异步加载?

    * Prerequisite: Is Your Application Ready for Asynchronous Loading?

    这篇关于UI5性能参数:data-sap-ui-preload与data-sap-ui-async的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆