title: Cordova app performance varies greatly between Android versions
body: <p>My environment:<br>
  Android Studio 2021.3.1 <br>
  cordova 11.0.0<br>
  gradle-7.5<br>
  Android Gradle Plugin 7.2<br>
  JDK 11 (Microsoft open version) - 11.0.15 (Microsoft 11.0.15+10-LTS)<br>
  Node v14.15.0<br>
  NPM 8.1.2<br>
  Target SDK = 32</p>
  <p>Plugins: media@6.0.0, insomnia, email-composer, wkwebview-file-xhr<br>
  Other: jquery, abcjs music notation library, fontawesome</p>
  <p>A similar question has been asked <a href="https://stackoverflow.com/questions/13308888/android-performance-hit-on-later-versions-than-2-3-5-phonegap-cordova/27941624#27941624">here</a> but that was over 9 years ago and looking for any updated info and for my specific issue.</p>
  <p>I'm struggling with a wide range of performance on different Android devices for my Cordova app. Android studio emulation for me seems to be fast on Android 7 but slow on Android 10 and unusable after that. The app works great on my Android 7 device. A friend's Android 10 device will hardly function. Android's pre-launch report gives one crash (ANR in com.android.systemui;PID: 756;executing service com.android.systemui/.dump.SystemUIAuxiliaryDumpService;) with 2 out of 8 devices having performance issues, both of them being Android 8.1, with working emulators from version 8 through 12.</p>
  <p>Based on research, it seems the issue may be related to</p>
  <ol>
  <li>editing html with JavaScript (due to bringing in text from external files, needing to populate data at runtime, etc) (I have 142 document.write statements. Does replacing innerHTML with jQuery have a different impact than writing a div?)</li>
  <li>use of $.get (purpose is to enable use of txt files to populate the app which can be easily edited on their own and copied into different projects. It also prevents having a huge index.html file. I load approx. 1 MB of text into memory and then just replace html as needed.)</li>
  <li>for loops (I use structure <code>var i = 0, len = importArray.length; for (; i&lt;len; i++) {</code>)</li>
  <li>many file references? (~9 css files, several .js files)</li>
  <li>possibly use of jQuery or maybe the abcjs library (I used to load jQuery mobile but removed it, but that didn't impact performance)</li>
  </ol>
  <p>The app must also be usable as a webpage to limit amount of extra effort (thus my use of Cordova), example: <a href="https://gospelriver.com/favhymns/" rel="nofollow noreferrer">https://gospelriver.com/favhymns/</a>. I also use local storage instead of databases so that it has the same functionality on the web and to make it easier to maintain the text files.</p>
  <p>Are any of the following relevant to try to incorporate in my project? I don't know where to start with further troubleshooting.</p>
  <ol>
  <li>Threading (can we even do this outside plugins? I see notices like &quot;Skipped 95 frames!  The application may be doing too much work on its main thread.&quot;)</li>
  <li>Crosswalk is suggested <a href="https://julienrenaux.fr/2015/08/24/ultimate-angularjs-and-ionic-performance-cheat-sheet/" rel="nofollow noreferrer">here</a>, but <a href="https://www.npmjs.com/package/cordova-plugin-crosswalk-webview-v3" rel="nofollow noreferrer">this</a> states it does not work for Android 10+ (which is a version I've seen problems with). Maybe a similar webview tool exists?</li>
  <li>Conversion to Ionic - sources say that won't improve performance since it's built on Cordova</li>
  <li>I've already redesigned the app once to pull in one song at a time rather than the whole hymnal into the index file, but maybe there is a different approach to coding that I need to consider based on my example <a href="https://gospelriver.com/favhymns/" rel="nofollow noreferrer">https://gospelriver.com/favhymns/</a></li>
  <li>Something else? I was hoping for a quick fix like Crosswalk apparently was at one time, but I'm not seeing it.</li>
  </ol>
  <p>If the problem is deemed to be coding, I suspect I should figure out Profiler, which I tried to use and it shows &quot;no supported devices&quot; - but that is a separate issue. If the app doesn't hardly load to begin with though, I'm not sure it will work.</p>