-
Notifications
You must be signed in to change notification settings - Fork 5
Possible map panning jank #9
Comments
After a some more rudimentary testing, it's not clear if the touch event isn't being registered or if actual jank is occuring. Need to frame the test better and compare against the on-device performance stats. |
Compared to plain old cordova map (POCM), ionic uses a lot more baseline CPU. POCM baseline is ~1.5% and panning/zooming uses between 45% - 50% CPU compared to between 50% - 60% with ionic. These numbers are not definitive, just an initial investigation into performance. Here's a snapshot of the CPU baseline for POCM: In comparison, here's the baseline CPU for ionic. User processes bouncing above 20%: |
Map performance has pretty much returned to almost normal while using JSAPI v3. Baseline CPU is tad higher than POCM, most likely due to Angular overhead, but it's bouncing between 0% - 3%. This is still better than the idling CPU usage seen with the JSAPI 4 beta and the shark's tooth pattern that spiked at 10%+. |
After a bit more testing, I'm going to say the performance with JSAPI v3 is 'as to be expected' for a simple app. I'm going to recommend we create a slightly more complex app that loads up the browser with features and uses renderers to twist the performance a bit. |
Memory footprint analysis using same device as above - memory usage not acceptable when compared to other non-Ionic Cordova apps. Memory headroom < 250KB. This may be part of the reason I'm seeing performance issues. I suspect with that little headroom and non-existent garbage collection that there is a lot of memory-to-memory copying going on and that's consuming extra CPU during map operations such as panning and zooming. In comparison, here's what I'd consider a more normal memory footprint. In the screenshot below the app consumes memory and there is a GC at regular but not excessive intervals. Here's an example of a normal GC that occurred when the app had about 450KB remaining in head room: |
Well I tried to take a look at this as a memory snapshot and ran into a possible Chrome bug. I'll try again next week, and maybe I'll get a response back from the Chromium folks by then. |
@jwasilgeo My Chrome memory profiling tools are working again after the last couple Chrome updates. We know that Cordova + JS API by itself works just fine. I can only conclude that there is something to do with how Angular and the JS API are interacting that is hosing performance. I was able to get a quick memory profile snapshot and dig around for a minutes. This is by no means conclusive, but I took snapshot while attempting to pan the map, so get an idea of what's hanging up.
Maybe Angular is getting hung up on keeping a huge amount of memory in Deferreds? |
Here's a 1 minute memory snapshot with Cordova-only and JS API 3.16 basic Hello World Map for comparison. CURRENT STATS: Per-Package Stats:
Summary:
Run time Stats: Memory usage:
Total elapsed time: +1h14m17s481ms (partial) libart.so |
And, here's a 1 minute memory snapshot with Cordova-only and JS API 4.0 basic Hello World Map for comparison. CURRENT STATS: Per-Package Stats:
Summary:
Run time Stats: Memory usage:
Total elapsed time: +1h20m12s804ms (partial) libart.so |
@jwasilgeo Looks like esri-angular-js1 (and JS API 3.17) has been ruled out as a CPU/Memory hog when used with Cordova by itself. It is using CPU and memory appropriately when Ionic is removed from the picture. I tested Cordova 6.2 with esri-angular-js1 on Android 6.0.1. CPU usage at idle is perfect. Memory usage good. The indicators now seem to be pointing at Ionic as the potential culprit for the memory usage. I did notice a similar odd CPU usage pattern when Ionic was removed from the picture in this test. Although without Ionic they were considerably muted and averaging about 4 - 5% CPU. It's possible that Ionic is magnifying something within angular that already exists. Screenshot below: Next step seems to be taking a bit closer look at Ionic to see if this is something obvious or if it's systemic and deep within the Ionic architecture. |
@andygup wow, thanks for researching this and providing me with a sigh of relief for our Angular+Esri integration library. It is surprising to hear that Ionic looks like it might be the culprit. |
Working on an unrelated Cordova project I stumbled across a use case that may be the key to isolating 2D map jank (jerkiness, screen freezing) in Cordova. Initial research is pointing towards using certain CSS properties in WebView and how they task the GPU. Further research is pending as this is all speculative at this point. Device: Android Nexus 5 running 6.0.1. Background: I noticed that a simple JS API app running on Cordova (without Ionic) was generating regular and fairly rapid GCs (garbage collection). It's important to note the application was idling. Digging further using Android systrace, I've been able to isolate skipped draw frames. The skipped frames occured when the WebView rendering activity occurred at the same time as the RenderThread's DrawFrame. DrawFrame is the "actual formation and issuing of drawing commands to the GPU." Supported Theory. In the same JS API app, I ran tests that didn't include the Esri SearchWidget or Next Steps. Continue to isolate the use case and identify elements that are causing memory leaks. Determine which widgets or libraries (CSS and/or JavaScript) cause jank. Screenshot 1 shows all four cores tasked, and at least one skipped draw frame and possible two around 3075 - 3090ms. The Render Thread capture, and associated Cordova processes show a pipelined sequence of events related to GPU tasking. This time slice demonstrates the underlying Android thread activity during pan and zoom events, but is critical in demonstrating a reproducible missed draw frame event. Breakout of active processes:
Screenshot 2 is a detailed view of the application's RenderThread's DrawFrame heartbeat. |
Additional references: |
I think I'm seeing map panning jank. Need to compare ionic map with plain old cordova map on same device.
The text was updated successfully, but these errors were encountered: