ServiceStack JsonServiceClient 3X slower on Xamarin Android

Any suggestions on why the JsonServiceClient would be 3-4X slower on Xamarin.Android than it is on IOS in the same Xamarin Forms project? IOS exhibits 700-1200ms load times (the same as a windows console app) and Android exhibits 3500-4500ms load times. Testing the REST query in a separate Rest Client app on the same Android device also returns 700-1200ms load times.

Any suggestions would be appreciated

What does load time mean? StartUp or runtime performance? What are the times for subsequent calls vs first call?

It’s essentially running the same code on both, the primary difference being iOS NoJIT limitations which prevent us from using compiled expressions / Reflection.Emit in text serializers to eliminate runtime reflection. If the issue is StartUp time then the reason is likely the startup cost of compiling the delegates.

Otherwise you can also try JsonHttpClient which is built on HttpClient, you can also use it with the plugin ModernHttpClient to see if that makes a difference.

Sorry for the ambiguity, its been a long day.

When I say load time I am referring to the REST call. This is the line of code I am measuring:
var resp = _service.Get(“SyncData/” + pdClientGUID);

However that rest call was always the first rest call when the application started up so I put another call ahead of it in the application load and that first call is now 2500ms on Android and the SyncData call above is in the 600ms range on Android, I’m seeing similar numbers on the SyncData call however that initial call is still 4X on Android

So it is definitely faster on IOS but understanding that initial startup cost is a good first step I can work with. Is the only way to initiate the “startup cost of compiling the delegates” to initiate a rest call? Or is there some sort of initialize method I could spin up early to absorb that cost in the background while the rest of my app loads?

I tried a couple quick test with the JsonHttpClient and it seems a little slower on IOS and a little faster on Android so I’ll play around with that some more tomorrow.

Thanks for your help. As always superb support.

The compiled delegates are for binding the serialized types, so you can prime the delegates by basically serializing/deserializing a fake object, e.g:

var dto = new ResponseType { Sub = new SubType { ... } };
var json = dto.ToJson();
var fromJson = json.FromJson<ResponseType>();