4

We're building a hybrid web app using sapui5 (built through phonegap build).

The startup time is a bit slow for the app as a whole including sapui5, so we would like to optimize it.

All the sapui5 files are packaged with the hybrid app, so there are no network request done during initialization.

This is our current initializiation of sapui5:

    <script id="sap-ui-bootstrap" type="text/javascript" src="sap-ui-core.js"
data-sap-ui-preload="sync"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-libs="sap.ui.layout,sap.viz,sap.ui.commons,sap.ui.unified,sap.ui.ux3,sap.ui.table,sap.suite.ui.commons,sap.m,sap.me"></script>

We're currently using sapui5 version 1.24.2.

I'll be using the performance.timing object to check the effect of any changes.

We will remove unused libs from the data-sap-ui-libs , but are there other actions that can be taken?

dparnas
  • 4,090
  • 4
  • 33
  • 52
  • reducing the data-sap-ui-libs had a huge impact. Went from 11.3 to 6.5 seconds (with a lot of other elements being loaded on the page). Measuring performance.timing.domComplete - performance.timing.requestStart from the chrome console – dparnas Apr 20 '15 at 13:35

3 Answers3

3

I'm not sure whether it helps with performance that much but make sure that you're using preload versions of libraries, such as sap/m/library-preload.json. That way you can also shrink the size of your hybrid app installation package as you can remove all the .js or -dgb.js files of the controls.

kjokinen
  • 101
  • 1
  • 1
  • 6
2

I am also building a hybrid app with performance issue when starting. I am running for android: cordova -v: 4.3.0 cordova platform version android: 3.7.1 And for ios: cordova -v: 5.1.1 cordova platform version android: 3.8.0

What I did was the following:

  • when you are using the mobile package (openui5-runtime-mobile-1.30.8.zip) in combination with data-sap-ui-preload="". This will save you a couple of calls
  • Like already mentioned from others, only use asynchronous calls
  • Try not to do stuff in the init methods of the controller that you don't need from the beginning from your start screen
  • check your application for time consuming actions - for example I had a sap.m.List without growing activated
  • I tried this but wasn't successful with it: http://scn.sap.com/community/developer-center/front-end/blog/2015/04/29/fast-responding-sapui5-core-library-loader
  • Using a splash screen -> just to "hide" the slow starting time
yaaZone
  • 48
  • 7
0

I had a similar problem. Because you load a lot of libraries, you should load them asynchronously and start when your core is ready:

   <script id="sap-ui-bootstrap" type="text/javascript" src="sap-ui-core.js"
data-sap-ui-preload="async"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-libs="sap.ui.layout,sap.viz,sap.ui.commons,sap.ui.unified,sap.ui.ux3,sap.ui.table,sap.suite.ui.commons,sap.m,sap.me"></script>

<script>


    var oCore = sap.ui.getCore().attachInit(function(){
    //start application
        });
    </script>

I found the answer partly here: How to load sapui5 resources in the background

Community
  • 1
  • 1
Daniël Camps
  • 1,737
  • 1
  • 22
  • 33
  • Thanks for the suggestion. As long as the files are already in the app and accessible through the file:// path I assume I have little to gain. [SAP Documentation on Preload variant](http://help.sap.com/saphelp_uiaddon10/helpdata/en/91/f1e3626f4d1014b6dd926db0e91070/content.htm) also indicate you need to handle the initialization explicitly (causing a bit more complexity in existing code) – dparnas Apr 20 '15 at 12:42