Fastest way to get AJAX function (xmlhttp)

Benchmark created by Jelle De Loecker on


Description

Look for the correct xmlhttp function OR get a xmlhttp function and get the other one if it failed

Test runner

Ready to run.

Testing in
TestOps/sec
Asking for permission
var http_request = false;
if (window.XMLHttpRequest) {
http_request = new XMLHttpRequest();
}
// IE
else if (window.ActiveXObject) {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
ready
Asking for forgiveness (Tertiary)
var x = this.ActiveXObject;
x = new(x ? x : XMLHttpRequest)('Microsoft.XMLHTTP');
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.