Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26346] Android: Apps are notable slower when using main-thread

GitHub Issuen/a
TypeBug
PriorityCritical
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 7.0.0
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterHans Knöchel
AssigneeJoshua Quick
Created2018-08-31T12:51:33.000+0000
Updated2018-11-14T23:40:43.000+0000

Description

(Raised via Slack a few times so far) I get a lot of
[INFO] :   Choreographer: Skipped 31 frames!  The application may be doing too much work on its main thread.
If I press a button to open a new page, there is a slight delay, if I set run on main thread to false its much smoother. iOS seems to have no problems with run on main thread set to true. Note (Hans): This is rather meant to be an investigation ticket rather than expecting a concrete fix. We need to verify the performance differences and plan something for SDK 8.0.0, since main-thread will be the default moving forward. For iOS, the kroll-thread will be removed completely, but it seem to play fine by now.

Comments

  1. Hans Knöchel 2018-11-14

    Why was this removed from 8.0.0? There should be an investigation on the performance impact, since 8.0.0+ will only allow the main-thread to be used. By now, this is a blocker for updating to 8.0.0.
  2. Joshua Quick 2018-11-14

    If someone is running into a performance issue, then it's likely something very specific. A "nebulous" ticket like this isn't very helpful. For example, if the APK is multidexed, then it will have a slow startup time on Android 4.x since OS versions older than 5.0 do not support multidexed apps. This means on Android 4.x, the app has to load the multiple dex libraries on app startup via software which is a long blocking operation. We can't fix that. You can only avoid it by either reducing the number of JARs or setting the min supported OS version to 5.0. Another example is image loading is blocking for all APIs other than ImageView.image on both Android and iOS. Such as "backgroundImage". If you use "backgroundImage" a lot, then consider using an ImageView instead for async image loading. And we're making optimizations all the time. We've optimized internal APK file access in 7.5.0. And we've added an async version of WebView.evalJS() in 8.0.0. Do you have anything specific you want to share with us?
  3. Joshua Quick 2018-11-14

    Also, you said you see a performance issue when opening windows. Does this only happen when analytics are enabled? We're currently posting analytics data on Android every time a window has been opened, closed, suspended, or resumed. We'll be changing this behavior in Titanium 8.0.0 to only report analytics when suspending/resuming the app like iOS instead. See: [TIMOB-26535] I'm curious if this is what you're seeing. Although, I'm not seeing a performance difference. Window open/close is fast for me.

JSON Source