Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 5027 [details]
Reported on behalf of a user.
## Steps to reproduce
1. Open and run the attached test case.
2. Push the "Click" button.
3. Notice how long the app takes before writing the response into the TextView.
4. Stop the app.
5. Uncomment one of the "Using HttpsURLConnection" or "Using AndroidHttpClient" regions, and comment out the "Using HttpClient" region.
6. Run the app again, and repeat steps 2 and 3.
`HttpsURLConnection` and `AndroidHttpClient` complete the request noticeably more quickly than `HttpClient`.
## Additional information
- At least in the user's full app, compiling in release mode and running on-device did not change the result.
- Plain HTTP requests are markedly faster than HTTPS requests. If there is a difference between `HttpClient` and the other options when performing HTTP requests, it is difficult to notice.
- Clicking the button a second time will send a second HTTPS request to a different server. If you switch the "google" and "facebook" URLs, the second ("google") request completes more quickly than when the "google" request runs first. This might vaguely suggest the involvement of a reverse DNS lookup bug from Android , except that:
1. The project is currently set to use Jelly Bean, so the bug should be fixed.
2. The "Using AndroidHttpClient" version shows no problem.
## Version information
Sounds like a JIT overhead issue.
This should be improved slightly in 4.14 (by moving much of the HTTPS stack into mscorlib.dll), but even then this will require JIT'ing the entire HTTPS stack in order to make the initial request -- Security, crypto, etc., etc. -- all of which the Android types won't require.
This will be improved once we offer AOT support.
This is expected, full managed implementation will be always slower than implementation which reuses native parts.
We could try to look into making the code faster but as we already have fast (AndroidHttpClient) implementation available I don't strong motivation to do it