I am having a problem with a Xamarin Forms project running on Android tablets (any model). Between the time I tap on a list item, which calls Nav.PushAsync(App.Locator.MyView....) to the time the page is actually finished rendering is about 14 seconds. The page is a TabbedPage with 4 ContentPage children. One of the ContentPages is using a DevExpress GridControl, which has been 3 and 5 columns depending on the scenario.
There is no CPU intensive or long running database queries in the load. If I step over each line of my code they run close to instantly. It looks like Mono hill climbing, SKIA, and the GC_*** garbage collector is what is causing the performance issues.
The runtime keeps complaining that I'm skipping frames and doing too much work on the UI thread, but there is no code that is taking time to run. It's databinding a XAML layout to a ViewModel, using a DevExpress GridControl and I think that is what is running slowly. There is no other way to do the data binding on a background thread that I'm aware of.
This is the output from my debug window:
AccountsViewModel detaching barcode scanner event handlers...
[0:] AccountsViewModel detaching barcode scanner event handlers...
05-24 15:27:49.680 I/mono-stdout( 3687): AccountsViewModel detaching barcode scanner event handlers...
Thread started: #13
05-24 15:27:50.700 D/dalvikvm( 3687): GC_EXPLICIT freed 2330K, 30% free 12182K/17240K, paused 2ms+5ms, total 29ms
05-24 15:27:50.710 D/Mono ( 3687): GC_OLD_BRIDGE num-objects 38 num_hash_entries 77901 sccs size 46926 init 0.00ms df1 197.69ms sort 75.33ms dfs2 82.46ms setup-cb 11.38ms free-data 159.79ms links 157068/157068/97050/10 dfs passes 235007/203994
05-24 15:27:50.710 D/Mono ( 3687): GC_MINOR: (Nursery full) pause 210.91ms, total 211.11ms, bridge 0.00ms promoted 6192K major 6192K los 3068K
Attaching barcode scan events
[0:] Attaching barcode scan events
05-24 15:27:50.940 I/mono-stdout( 3687): Attaching barcode scan events
Refreshing serial cable devices on background thread...
[0:] Refreshing serial cable devices on background thread...
05-24 15:27:51.330 I/mono-stdout( 3687): Refreshing serial cable devices on background thread...
USB cable detached
[0:] USB cable detached
05-24 15:27:51.340 I/mono-stdout( 3687): USB cable detached
USB cable detached
[0:] USB cable detached
05-24 15:27:51.350 I/mono-stdout( 3687): USB cable detached
05-24 15:27:51.360 D/Mono ( 3687): [0x67bf6288] hill climbing, change max number of threads 4
05-24 15:27:51.420 I/Choreographer( 3687): Skipped 105 frames! The application may be doing too much work on its main thread.
05-24 15:27:51.480 D/skia ( 3687): Skia Error: Invalid Argument: I got -0.500000 and -0.500000 as radii to SkPath::AddRoundRect, but negative radii are not allowed.
05-24 15:27:51.490 D/skia ( 3687): Skia Error: Invalid Argument: I got -0.500000 and -0.500000 as radii to SkPath::AddRoundRect, but negative radii are not allowed.
05-24 15:27:51.490 D/skia ( 3687): Skia Error: Invalid Argument: I got -0.500000 and -0.500000 as radii to SkPath::AddRoundRect, but negative radii are not allowed.
05-24 15:27:51.500 D/skia ( 3687): Skia Error: Invalid Argument: I got -0.500000 and -0.500000 as radii to SkPath::AddRoundRect, but negative radii are not allowed.
05-24 15:27:51.510 D/skia ( 3687): Skia Error: Invalid Argument: I got -0.500000 and -0.500000 as radii to SkPath::AddRoundRect, but negative radii are not allowed.
05-24 15:27:51.510 D/skia ( 3687): Skia Error: Invalid Argument: I got -0.500000 and -0.500000 as radii to SkPath::AddRoundRect, but negative radii are not allowed.
5/24/2016 3:27:51 PM Refreshing Bluetooth DEX connection on background thread...
[0:] 5/24/2016 3:27:51 PM Refreshing Bluetooth DEX connection on background thread...
05-24 15:27:51.530 I/mono-stdout( 3687): 5/24/2016 3:27:51 PM Refreshing Bluetooth DEX connection on background thread...
Bluetooth not enabled, not going to ConnectAsync()
05-24 15:27:51.530 I/mono-stdout( 3687): Bluetooth not enabled, not going to ConnectAsync()
5/24/2016 3:27:51 PM Done loading Bluetooth DEX
05-24 15:27:51.530 I/mono-stdout( 3687): 5/24/2016 3:27:51 PM Done loading Bluetooth DEX
Thread started: #14
[0:] 5/24/2016 3:27:51 PM Done loading Bluetooth DEX
Thread started: #15
05-24 15:27:51.570 D/Mono ( 3687): [0x6b9589e0] worker starting
05-24 15:27:51.570 D/Mono ( 3687): [0x6b284490] worker starting
ServiceMachinePage OnPageAppearing()
[0:] ServiceMachinePage OnPageAppearing()
05-24 15:27:51.610 I/mono-stdout( 3687): ServiceMachinePage OnPageAppearing()
5/24/2016 3:27:51 PM LoadRestockAsync() starting ...
[0:] 5/24/2016 3:27:51 PM LoadRestockAsync() starting ...
05-24 15:27:51.710 I/mono-stdout( 3687): 5/24/2016 3:27:51 PM LoadRestockAsync() starting ...
05-24 15:27:52.600 D/dalvikvm( 3687): GC_EXPLICIT freed 219K, 23% free 13397K/17240K, paused 2ms+4ms, total 28ms
05-24 15:27:52.600 D/Mono ( 3687): GC_OLD_BRIDGE num-objects 62 num_hash_entries 97170 sccs size 56238 init 0.00ms df1 260.45ms sort 95.48ms dfs2 117.83ms setup-cb 13.77ms free-data 185.24ms links 201267/201267/224656/4 dfs passes 298499/257505
05-24 15:27:52.600 D/Mono ( 3687): GC_MINOR: (Nursery full) pause 278.15ms, total 278.37ms, bridge 0.00ms promoted 6848K major 6848K los 3741K
05-24 15:27:53.410 D/Mono ( 3687): GC_OLD_BRIDGE num-objects 62 num_hash_entries 97170 sccs size 56238 init 0.00ms df1 260.45ms sort 95.48ms dfs2 117.83ms setup-cb 13.77ms free-data 185.24ms links 0/0/0/0 dfs passes 0/0
05-24 15:27:53.410 D/Mono ( 3687): GC_MINOR: (Nursery full) pause 6.24ms, total 6.49ms, bridge 0.00ms promoted 7056K major 7056K los 3749K
05-24 15:27:54.160 D/Mono ( 3687): GC_OLD_BRIDGE num-objects 62 num_hash_entries 97170 sccs size 56238 init 0.00ms df1 260.45ms sort 95.48ms dfs2 117.83ms setup-cb 13.77ms free-data 185.24ms links 0/0/0/0 dfs passes 0/0
05-24 15:27:54.160 D/Mono ( 3687): GC_MINOR: (Nursery full) pause 10.31ms, total 10.55ms, bridge 0.00ms promoted 7472K major 7472K los 3789K
05-24 15:27:54.310 I/mono-stdout( 3687): SetupMicromarketGrid executed in 88.199 ms.
Loading service call grid
[0:] Loading service call grid
05-24 15:27:54.400 I/mono-stdout( 3687): Loading service call grid
LoadRestockAsync() took 2698.533 ms to load
[0:] LoadRestockAsync() took 2698.533 ms to load
05-24 15:27:54.410 I/mono-stdout( 3687): LoadRestockAsync() took 2698.533 ms to load
Opening barcode scanner...
[0:] Opening barcode scanner...
05-24 15:27:54.420 I/mono-stdout( 3687): Opening barcode scanner...
Opening scan API...
05-24 15:27:54.430 I/mono-stdout( 3687): Opening scan API...
Scan API opened
Attaching barcode scan events
05-24 15:27:54.430 I/mono-stdout( 3687): Scan API opened
[0:] Attaching barcode scan events
05-24 15:27:54.430 I/mono-stdout( 3687): Attaching barcode scan events
Thread started: ScanAPIHelperInit #16
Reading file contents license.json as string
05-24 15:27:54.440 I/mono-stdout( 3687): Reading file contents license.json as string
Scan API initialized!
Thread finished: ScanAPIHelperInit #16
05-24 15:27:54.450 I/mono-stdout( 3687): Scan API initialized!
ServiceMachinePage OnPageAppearing()
[0:] ServiceMachinePage OnPageAppearing()
05-24 15:27:54.470 I/mono-stdout( 3687): ServiceMachinePage OnPageAppearing()
5/24/2016 3:27:54 PM LoadRestockAsync() starting ...
[0:] 5/24/2016 3:27:54 PM LoadRestockAsync() starting ...
05-24 15:27:54.570 I/mono-stdout( 3687): 5/24/2016 3:27:54 PM LoadRestockAsync() starting ...
The thread 'Unknown' (0x10) has exited with code 0 (0x0).
05-24 15:27:57.360 D/dalvikvm( 3687): GC_EXPLICIT freed 684K, 21% free 13721K/17240K, paused 2ms+5ms, total 27ms
05-24 15:27:57.360 D/Mono ( 3687): GC_OLD_BRIDGE num-objects 78 num_hash_entries 116669 sccs size 67051 init 0.00ms df1 288.60ms sort 113.21ms dfs2 288.89ms setup-cb 16.34ms free-data 394.45ms links 241001/241001/1404038/21 dfs passes 357748/308052
05-24 15:27:57.360 D/Mono ( 3687): GC_MINOR: (Nursery full) pause 316.56ms, total 316.81ms, bridge 0.00ms promoted 8816K major 8816K los 5134K
05-24 15:27:58.220 D/Mono ( 3687): GC_OLD_BRIDGE num-objects 78 num_hash_entries 116669 sccs size 67051 init 0.00ms df1 288.60ms sort 113.21ms dfs2 288.89ms setup-cb 16.34ms free-data 394.45ms links 0/0/0/0 dfs passes 0/0
05-24 15:27:58.220 D/Mono ( 3687): GC_MINOR: (Nursery full) pause 6.35ms, total 6.57ms, bridge 0.00ms promoted 9056K major 9056K los 5134K
05-24 15:27:59.000 D/Mono ( 3687): GC_OLD_BRIDGE num-objects 78 num_hash_entries 116669 sccs size 67051 init 0.00ms df1 288.60ms sort 113.21ms dfs2 288.89ms setup-cb 16.34ms free-data 394.45ms links 0/0/0/0 dfs passes 0/0
05-24 15:27:59.000 D/Mono ( 3687): GC_MINOR: (Nursery full) pause 7.64ms, total 7.89ms, bridge 0.00ms promoted 9424K major 9424K los 5158K
05-24 15:27:59.150 D/Mono ( 3687): [0x6b284490] hill climbing, change max number of threads 5
SetupFoodOrMicromarketGrid executed in 1241.107 ms.
[0:] SetupFoodOrMicromarketGrid executed in 1241.107 ms.
05-24 15:28:00.320 I/mono-stdout( 3687): SetupFoodOrMicromarketGrid executed in 1241.107 ms.
Grid_SelectionChanged() 0
[0:] Grid_SelectionChanged() 0
05-24 15:28:00.570 I/mono-stdout( 3687): Grid_SelectionChanged() 0
LoadRestockAsync() took 6031.189 ms to load
[0:] LoadRestockAsync() took 6031.189 ms to load
05-24 15:28:00.600 I/mono-stdout( 3687): LoadRestockAsync() took 6031.189 ms to load
Opening barcode scanner...
05-24 15:28:00.630 I/mono-stdout( 3687): Opening barcode scanner...
[0:] Opening barcode scanner...
Opening scan API...
05-24 15:28:00.640 I/mono-stdout( 3687): Opening scan API...
Thread started: ScanAPIHelperInit #17
Scan API opened
05-24 15:28:00.650 I/mono-stdout( 3687): Scan API opened
Attaching barcode scan events
[0:] Attaching barcode scan events
05-24 15:28:00.650 I/mono-stdout( 3687): Attaching barcode scan events
Scan API initialized!
Thread finished: ScanAPIHelperInit #17
05-24 15:28:00.650 I/mono-stdout( 3687): Scan API initialized!
Reading file contents license.json as string
05-24 15:28:00.660 I/mono-stdout( 3687): Reading file contents license.json as string
The thread 'Unknown' (0x11) has exited with code 0 (0x0).
05-24 15:28:00.690 I/Choreographer( 3687): Skipped 545 frames! The application may be doing too much work on its main thread.
05-24 15:28:00.790 D/skia ( 3687): Skia Error: Invalid Argument: I got -0.500000 and -0.500000 as radii to SkPath::AddRoundRect, but negative radii are not allowed.
05-24 15:28:00.790 D/skia ( 3687): Skia Error: Invalid Argument: I got -0.500000 and -0.500000 as radii to SkPath::AddRoundRect, but negative radii are not allowed.
05-24 15:28:00.800 D/skia ( 3687): Skia Error: Invalid Argument: I got -0.500000 and -0.500000 as radii to SkPath::AddRoundRect, but negative radii are not allowed.
05-24 15:28:00.800 D/skia ( 3687): Skia Error: Invalid Argument: I got -0.500000 and -0.500000 as radii to SkPath::AddRoundRect, but negative radii are not allowed.
05-24 15:28:00.800 D/skia ( 3687): Skia Error: Invalid Argument: I got -0.500000 and -0.500000 as radii to SkPath::AddRoundRect, but negative radii are not allowed.
05-24 15:28:00.800 D/skia ( 3687): Skia Error: Invalid Argument: I got -0.500000 and -0.500000 as radii to SkPath::AddRoundRect, but negative radii are not allowed.
05-24 15:28:02.410 D/dalvikvm( 3687): GC_EXPLICIT freed 836K, 18% free 14243K/17240K, paused 2ms+5ms, total 29ms
05-24 15:28:02.420 D/Mono ( 3687): GC_OLD_BRIDGE num-objects 116 num_hash_entries 134092 sccs size 79636 init 0.00ms df1 332.88ms sort 172.36ms dfs2 406.29ms setup-cb 18.90ms free-data 426.90ms links 273887/273887/2380543/30 dfs passes 408095/353523
05-24 15:28:02.420 D/Mono ( 3687): GC_MINOR: (Nursery full) pause 364.93ms, total 365.13ms, bridge 0.00ms promoted 11024K major 11024K los 5855K
Thread started: #18
05-24 15:28:02.960 D/Mono ( 3687): [0x686d6a88] worker starting
05-24 15:28:02.970 I/Choreographer( 3687): Skipped 136 frames! The application may be doing too much work on its main thread.
05-24 15:28:03.160 D/Mono ( 3687): GC_BRIDGE waiting for bridge processing to finish
05-24 15:28:03.230 D/dalvikvm( 3687): GC_EXPLICIT freed 1377K, 20% free 13885K/17240K, paused 2ms+4ms, total 29ms
05-24 15:28:03.230 D/Mono ( 3687): GC_BRIDGE waiting for bridge processing to finish
05-24 15:28:03.230 D/Mono ( 3687): GC_OLD_BRIDGE num-objects 489 num_hash_entries 11591 sccs size 7202 init 0.00ms df1 27.42ms sort 9.40ms dfs2 8.81ms setup-cb 1.59ms free-data 17.23ms links 15292/15292/6732/3 dfs passes 27372/22494
05-24 15:28:03.230 D/Mono ( 3687): GC_MAJOR: (LOS overflow) pause 123.51ms, total 124.61ms, bridge 0.00ms major 9888K/0K los 469K/0K
05-24 15:28:03.240 D/Mono ( 3687): [0x6b1a9010] hill climbing, change max number of threads 4