Skip to content

Latest commit

 

History

History
85 lines (57 loc) · 3.49 KB

Load_Only_What_You_Really_Need_e8fca3e.md

File metadata and controls

85 lines (57 loc) · 3.49 KB
loio
e8fca3e4c68a4f289660299d806ba99e

Load Only What You Really Need

The amount of resources and data that your app loads will directly affect the performance of your app. You should declare all dependencies and remove unused libraries and classes from your code.


Always define the libraries you use in the manifest and remove all libraries that you do not intend to use in your code. If you have no manifest, you have to specify the used libraries in the OpenUI5 bootstrap. If you specify the used libraries in either place, they are loaded optimized. This means that all used controls, styles, etc. are not requested separately. For every mentioned library, the library preload file, the library styles, and the text translations are loaded once during the application startup. No further requests are necessary while using the application, because all needed artefacts are already included in the respective library preload file.

"sap.ui5": {
	"dependencies": {
		"minUI5Version": "1.60.0",
		"libs": {
			"sap.ui.core": {},
			"sap.m": {},
			"sap.ui.layout": {}
		}
	}
	...
}

In the JavaScript files of your app, define all dependencies to OpenUI5 framework classes and app resources via sap.ui.define. If you have unused dependencies, you should remove them right away.

The UI5 Tooling can then create a "cleaned-up" version of your app that only contains the resources you really need. The so-called application preload will greatly speed up the initial load time of your app.

sap.ui.define([
	"sap/ui/core/mvc/Controller",
	"sap/m/MessageToast",
	"sap/base/Log"
], function (Controller, MessageToast, Log) {
	...

Use controls like sap.m.List or UI patterns that support displaying data selectively or with pagination. Make sure that your backend service is designed to deliver small chunks of data as well.

<List
	growing="true"
	growingThreshold="20"
	...>