Skip to content

jonathanpeppers/anticipator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AnticipatorTest

Testing the Anticipator:

https://github.com/xamarin/Xamarin.Forms/blob/4481863bb86010fecbfae41b5ffa1bd3eaa9f105/Xamarin.Forms.Platform.Android/Anticipator.cs

The idea is we can use a Stopwatch to compare its performance characteristics. I print the result to adb logcat output. We can average the time taken over 10 runs programmatically.

Run the powershell script included via:

.\compare.ps1 -anticipator $true -configuration Debug
.\compare.ps1 -anticipator $false -configuration Debug
.\compare.ps1 -anticipator $true -configuration Release
.\compare.ps1 -anticipator $false -configuration Release

There are other options in the script as well.

Results

My general conclusion is the Anticipator has slightly worse performance when the intent was to improve it.

HAXM emulator (Debug):

> .\compare.ps1 -anticipator $true -configuration Debug
12-11 08:57:25.508 21971 21971 D GREPME  : 131
12-11 08:57:29.677 22025 22025 D GREPME  : 131
12-11 08:57:33.799 22098 22098 D GREPME  : 142
12-11 08:57:37.925 22150 22150 D GREPME  : 137
12-11 08:57:42.028 22206 22206 D GREPME  : 128
12-11 08:57:46.173 22259 22259 D GREPME  : 159
12-11 08:57:50.236 22312 22312 D GREPME  : 127
12-11 08:57:54.431 22365 22365 D GREPME  : 176
12-11 08:57:58.485 22419 22419 D GREPME  : 132
12-11 08:58:02.660 22471 22471 D GREPME  : 137
12-11 08:58:06.757 22524 22524 D GREPME  : 154
Average: 141.272727272727
> .\compare.ps1 -anticipator $false -configuration Debug
12-11 08:58:58.540 22702 22702 D GREPME  : 109
12-11 08:59:02.635 22753 22753 D GREPME  : 110
12-11 08:59:06.740 22804 22804 D GREPME  : 103
12-11 08:59:10.919 22857 22857 D GREPME  : 110
12-11 08:59:15.024 22909 22909 D GREPME  : 109
12-11 08:59:19.141 22962 22962 D GREPME  : 107
12-11 08:59:23.273 23010 23010 D GREPME  : 105
12-11 08:59:27.400 23061 23061 D GREPME  : 104
12-11 08:59:31.497 23109 23109 D GREPME  : 112
12-11 08:59:35.632 23161 23161 D GREPME  : 109
12-11 08:59:39.727 23212 23212 D GREPME  : 112
Average: 108.181818181818

HAXM emulator (Release):

> .\compare.ps1 -anticipator $true -configuration Release
12-11 09:00:31.761 23402 23402 D GREPME  : 82
12-11 09:00:35.885 23453 23453 D GREPME  : 84
12-11 09:00:40.022 23505 23505 D GREPME  : 83
12-11 09:00:44.160 23558 23558 D GREPME  : 92
12-11 09:00:48.353 23609 23609 D GREPME  : 103
12-11 09:00:52.422 23660 23660 D GREPME  : 90
12-11 09:00:56.557 23708 23708 D GREPME  : 81
12-11 09:01:00.737 23762 23762 D GREPME  : 83
12-11 09:01:04.855 23814 23814 D GREPME  : 79
12-11 09:01:08.944 23865 23865 D GREPME  : 83
12-11 09:01:13.103 23915 23915 D GREPME  : 88
Average: 86.1818181818182
> .\compare.ps1 -anticipator $false -configuration Release
12-11 09:01:53.967 24126 24126 D GREPME  : 62
12-11 09:01:58.076 24177 24177 D GREPME  : 63
12-11 09:02:02.223 24229 24229 D GREPME  : 62
12-11 09:02:06.454 24280 24280 D GREPME  : 69
12-11 09:02:10.479 24329 24329 D GREPME  : 66
12-11 09:02:14.582 24377 24377 D GREPME  : 66
12-11 09:02:18.708 24424 24424 D GREPME  : 68
12-11 09:02:22.845 24471 24471 D GREPME  : 61
12-11 09:02:26.979 24523 24523 D GREPME  : 59
12-11 09:02:31.143 24572 24572 D GREPME  : 61
12-11 09:02:35.203 24618 24618 D GREPME  : 62
Average: 63.5454545454545

Pixel 3 XL (Debug):

> .\compare.ps1 -anticipator $true -configuration Debug
12-11 09:08:26.120  4849  4849 D GREPME  : 100
12-11 09:08:30.373  4914  4914 D GREPME  : 100
12-11 09:08:34.686  4985  4985 D GREPME  : 101
12-11 09:08:38.981  5062  5062 D GREPME  : 111
12-11 09:08:43.242  5133  5133 D GREPME  : 101
12-11 09:08:47.555  5200  5200 D GREPME  : 100
12-11 09:08:51.814  5266  5266 D GREPME  : 101
12-11 09:08:56.054  5343  5343 D GREPME  : 102
12-11 09:09:00.337  5413  5413 D GREPME  : 101
12-11 09:09:04.590  5481  5481 D GREPME  : 100
12-11 09:09:08.832  5554  5554 D GREPME  : 100
Average: 101.545454545455
> .\compare.ps1 -anticipator $false -configuration Debug
12-11 09:09:43.340  5845  5845 D GREPME  : 93
12-11 09:09:47.586  5911  5911 D GREPME  : 97
12-11 09:09:51.822  5979  5979 D GREPME  : 93
12-11 09:09:56.102  6041  6041 D GREPME  : 92
12-11 09:10:00.376  6097  6097 D GREPME  : 93
12-11 09:10:04.664  6156  6156 D GREPME  : 93
12-11 09:10:08.916  6214  6214 D GREPME  : 93
12-11 09:10:13.160  6269  6269 D GREPME  : 93
12-11 09:10:17.453  6331  6331 D GREPME  : 93
12-11 09:10:21.726  6396  6396 D GREPME  : 92
12-11 09:10:25.963  6450  6450 D GREPME  : 93
Average: 93.1818181818182

Pixel 3 XL (Release):

> .\compare.ps1 -anticipator $true -configuration Release
12-11 09:11:16.966  6675  6675 D GREPME  : 45
12-11 09:11:21.227  6734  6734 D GREPME  : 45
12-11 09:11:25.497  6795  6795 D GREPME  : 48
12-11 09:11:29.775  6865  6865 D GREPME  : 47
12-11 09:11:34.019  6931  6931 D GREPME  : 45
12-11 09:11:38.302  6992  6992 D GREPME  : 46
12-11 09:11:42.549  7052  7052 D GREPME  : 46
12-11 09:11:46.825  7111  7111 D GREPME  : 46
12-11 09:11:51.078  7172  7172 D GREPME  : 46
12-11 09:11:55.323  7232  7232 D GREPME  : 44
12-11 09:11:59.598  7291  7291 D GREPME  : 46
Average: 45.8181818181818
> .\compare.ps1 -anticipator $false -configuration Release
12-11 09:12:37.602  7498  7498 D GREPME  : 38
12-11 09:12:41.847  7551  7551 D GREPME  : 38
12-11 09:12:46.119  7603  7603 D GREPME  : 38
12-11 09:12:50.411  7654  7654 D GREPME  : 38
12-11 09:12:54.672  7711  7711 D GREPME  : 38
12-11 09:12:58.926  7765  7765 D GREPME  : 39
12-11 09:13:03.173  7816  7816 D GREPME  : 39
12-11 09:13:07.452  7871  7871 D GREPME  : 39
12-11 09:13:11.740  7924  7924 D GREPME  : 39
12-11 09:13:15.998  7974  7974 D GREPME  : 38
12-11 09:13:20.278  8025  8025 D GREPME  : 39
Average: 38.4545454545455

Pixel 3 XL (Release+AOT):

> .\compare.ps1 -anticipator $true -configuration Release -extra /p:AotAssemblies=True
12-11 09:52:30.831  9266  9266 D GREPME  : 33
12-11 09:52:35.060  9330  9330 D GREPME  : 34
12-11 09:52:39.323  9428  9428 D GREPME  : 33
12-11 09:52:43.610  9486  9486 D GREPME  : 33
12-11 09:52:47.904  9550  9550 D GREPME  : 33
12-11 09:52:52.213  9610  9610 D GREPME  : 34
12-11 09:52:56.469  9670  9670 D GREPME  : 34
12-11 09:53:00.728  9729  9729 D GREPME  : 33
12-11 09:53:05.023  9787  9787 D GREPME  : 35
12-11 09:53:09.303  9847  9847 D GREPME  : 34
12-11 09:53:13.587  9907  9907 D GREPME  : 34
Average: 33.636363636363
> .\compare.ps1 -anticipator $false -configuration Release -extra /p:AotAssemblies=True
12-11 09:54:50.942 10135 10135 D GREPME  : 30
12-11 09:54:55.240 10188 10188 D GREPME  : 30
12-11 09:54:59.536 10238 10238 D GREPME  : 30
12-11 09:55:03.818 10288 10288 D GREPME  : 30
12-11 09:55:08.058 10339 10339 D GREPME  : 30
12-11 09:55:12.320 10392 10392 D GREPME  : 30
12-11 09:55:16.607 10444 10444 D GREPME  : 36
12-11 09:55:20.799 10574 10574 D GREPME  : 30
12-11 09:55:25.040 10626 10626 D GREPME  : 30
12-11 09:55:29.305 10685 10685 D GREPME  : 30
12-11 09:55:33.585 10738 10738 D GREPME  : 30
Average: 30.5454545454545