openhab / openhab-webui

Web UIs of openHAB
Eclipse Public License 2.0
218 stars 239 forks source link

loadingtime of page is an exponential function of the number of items in the page (at least on Android in any browser) #1746

Open galexey opened 1 year ago

galexey commented 1 year ago

Loading of pages on Android phones / Tabs is painfully slow when there are many items in the page. Through my experiments I found out that the loadingtime is an exponential function of the number of items used in the page. it is roughly number_of_items ^2.5

I created several performance test pages through a script. the page attached contains 200 cards with an icon and a switch referring to an openhab switch item). image

the loadingtimes on my Android phone (samsung galaxy A71) are as follows:

number of items in the page : seconds to load page 100: 4.7s 200: 12.2s 400: 45.9s 800: 173s 1600: 964s

I assume that there is a loop going through all items nested within another loop going through all items somewhere in the javascript for android devices.

Expected behavior

I would expect that the loading time is at least LINEAR function of the number of items in the page.

Steps to reproduce

  1. add the testitems.items file in the items folder in openhab files.zip

  2. create a new loayout page and add the content from performance_test_page.yaml

  3. open the page on an android device

Your environment

runtimeInfo: version: 3.4.2 buildString: Release Build locale: en-US systemInfo: configFolder: /openhab/conf userdataFolder: /openhab/userdata logFolder: /openhab/userdata/logs javaVersion: 11.0.18 javaVendor: Eclipse Adoptium javaVendorVersion: Temurin-11.0.18+10 osName: Linux osVersion: 5.4.0-107-generic osArchitecture: amd64 availableProcessors: 12 freeMemory: 1021005560 totalMemory: 1718616064 startLevel: 70 bindings:

Browser console

as this is related to mobile devices I did not know how to get the browser console.

Browser network traffic

as this is related to mobile devices I did not know how to get the browser console.

Additional information

There are many issues / forum entries around this problem:

1424

1314

https://community.openhab.org/t/oh3-ui-slow-on-android-app/130186/11 https://community.openhab.org/t/webui-and-android-mobile-app-performance-when-using-layout-pages-with-20-labeld-cells/129084/6 https://community.openhab.org/t/oh-3-ui-is-very-slow-on-any-browser-in-android-and-windows-but-super-fast-on-any-browser-in-ios/130006/3

galexey commented 1 year ago

this is from my mobile: `runtimeInfo: version: 3.4.2 buildString: Release Build locale: en-US systemInfo: configFolder: /openhab/conf userdataFolder: /openhab/userdata logFolder: /openhab/userdata/logs javaVersion: 11.0.18 javaVendor: Eclipse Adoptium javaVendorVersion: Temurin-11.0.18+10 osName: Linux osVersion: 5.4.0-107-generic osArchitecture: amd64 availableProcessors: 12 freeMemory: 1159835648 totalMemory: 1718616064 startLevel: 70 bindings: