UI5 performance parameters: data-sap-ui-preload vs. data-sap-ui-async

橙三吉。 提交于 2021-01-03 06:53:47

问题


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

  1. 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.

  2. data-sap-ui-async="true"

    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?


回答1:


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

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

  • […]
  • 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.

async

This configuration setting enables the module loader to load both, modules and library-preload files asynchronously.


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?




回答2:


I wanna add some more information to the answer of Boghyon. It's not a replacement in regards to data-sap-ui-async and data-sap-ui-preload. data-sap-ui-async is an additional offering which enables simply more asynchronous features of UI5. See also the performance section.



来源:https://stackoverflow.com/questions/54801365/ui5-performance-parameters-data-sap-ui-preload-vs-data-sap-ui-async

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!