Fastest way to get AJAX function (xmlhttp) (v4)

Revision 4 of this benchmark created by Tri 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 x;window.XMLHttpRequest?x=new XMLHttpRequest:window.ActiveXObject&&(x=new ActiveXObject("Microsoft.XMLHTTP"))
ready
Asking for forgiveness (Tertiary)
var x = this.ActiveXObject;
x = new(x ? x : XMLHttpRequest)('Microsoft.XMLHTTP');
ready
test 3
var x=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
ready
test 4
var x=new(window.XMLHttpRequest||ActiveXObject)('Microsoft.XMLHTTP')
ready
test 5
var x;

try {
 x = new XMLHttpRequest();

}

catch(e) {
x = new ActiveXObject("Microsoft.XMLHTTP");
}
ready

Revisions

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