1

I have completed an app in SAPUI5 & deployed in FLP. It takes more than a minute to load for the first time after which it takes only 2 to 3 seconds.

When I run Performance in Chrome console, it shows scripting takes too much time. How can I reduce my app's initial loading time?

index.html

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Orders</title>
    <script id="sap-ui-bootstrap"
      src="/sap/public/bc/ui5_ui5/1/resources/sap-ui-core.js"
      data-sap-ui-libs="sap.m, sap.ui.core"
      data-sap-ui-theme="sap_belize"
      data-sap-ui-bindingSyntax="complex"
      data-sap-ui-compatVersion="edge"
      data-sap-ui-preload="async"
      data-sap-ui-resourceroots='{"orders": "."}'
    ></script>
    <script>
      sap.ui.getCore().attachInit(function () {
        sap.ui.require([
          "sap/m/Shell",
          "sap/ui/core/ComponentContainer"
        ], function (Shell, ComponentContainer) {
          new Shell({
            app: new ComponentContainer({
              height : "100%",
              name : "orders"
            })
          }).placeAt("content");
        });
      });
    </script>
  </head>
  <body class="sapUiBody" id="content">
  </body>
</html>

Controller Modules

sap.ui.define([
  "./BaseController",
  "sap/ui/model/json/JSONModel",
  "sap/ui/core/routing/History",
  "../model/formatter",
  "sap/ui/model/Filter",
  "sap/ui/model/FilterOperator",
  "sap/m/MessageToast"
], function(BaseController, JSONModel, /* ... */) { /*... */ }));

XML Namespaces

<mvc:View
  xmlns:mvc="sap.ui.core.mvc"
  xmlns="sap.m"
  xmlns:semantic="sap.m.semantic"
  xmlns:core="sap.ui.core"
  xmlns:table="sap.ui.table"
  xmlns:smartTable="sap.ui.comp.smarttable"
  xmlns:customData="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
  controllerName="orders.controller.Worklist"
>
  <!-- ... -->
</mvc:View>
Jasperan
  • 2,154
  • 1
  • 16
  • 40
Haritha Perumal
  • 23
  • 2
  • 10

3 Answers3

3

Technical Optimizations

I see you're using sap.ui.comp.smarttable.SmartTable without preloading its dependencies.

You can definitely reduce the app's initial load time massively by:

The above mentioned points apply generally to all UI5 applications, not only to SmartTable.
For other performance related guidelines, see Performance Checklist.

Psychological Optimizations

Besides technical optimizations, perception management should be also taken into account.

  1. It's important to note that perceived performance is the real performance. The hard number of milliseconds isn't what really matters.
  2. In order to indicate that something is happening, we can make use of busy state, BusyIndicator, BusyDialog, and ProgressIndicator according to the graphic below:

busy and progress indicator

Source: Psychological Time: Tolerance Management

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
  • Thank You so much !! .. I will try& let you know. – Haritha Perumal May 11 '18 at 13:48
  • @HarithaPerumal The SmartTable was just an example. You might have other controls whose dependent libraries aren't being preloaded. Please, look for them too. Usually, the *Network* panel in Chrome's devtool shows which libraries are loaded on-demand synchronously which is what happens if not preloaded. – Boghyon Hoffmann May 14 '18 at 09:10
  • I have preloaded dependencies & added Component-preload.js. Now it takes only 6 seconds for the first time. Thank you for your response !!! :) – Haritha Perumal May 14 '18 at 10:01
  • @HarithaPerumal The *Component-preload.js* shouldn't have to be created manually when you were deploying the app on FLP from Web IDE (as Web IDE creates the file automatically for you). Or were you using a different IDE? – Boghyon Hoffmann May 14 '18 at 10:06
  • I am using Web IDE. When I deployed app to SAP cloud platform, It has created a dist folder with _Component-preload.js_ file in it. – Haritha Perumal May 15 '18 at 08:45
  • @HarithaPerumal Exactly ;) On FLP, the *dist* folder is the folder from which the app will run. No need to add *Component-preload.js* by yourself :) – Boghyon Hoffmann May 15 '18 at 09:00
  • Yes !! Thank You :) – Haritha Perumal May 15 '18 at 14:11
0

Although a minute takes too long, it is normal for a UI5 app to load longer the first time you run it because it downloads the UI5 libraries from the UI5 server -- after the libraries are downloaded, they are then cached to your browser hence, it is much faster in the next runs.

Kawamoto Takeshi
  • 596
  • 1
  • 3
  • 24
-1

Component Preload file helps in increasing your app performance in intial load. You can create this file easily, for example, from SAP Web IDE: right click on the project → BuildBuild Project to create / update the preload file.

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
  • Creating an application bundle helps but it doesn't solve the [root cause of the actual performance issue](https://stackoverflow.com/a/50293511/5846045). – Boghyon Hoffmann Oct 21 '20 at 14:04