Testreplace

JavaScript performance comparison

Test case created

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Replace
function S4() {
    return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}

function generateGUID(){
    var l_guid = (S4() + S4() + "-" + S4() + "-4" + S4().substr(0,3) + "-" + S4() + "-" + S4() + S4() + S4()).toLowerCase();
    return l_guid;
}

function run(){
var l_guid = generateGUID();
var l_hexGuid = parseInt(l_guid.replace(/-/g,"").substring(20,l_guid.length),16)%6;
console.log(l_hexGuid);
return true;
}
run();
 
pending…
Split
function S4() {
    return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}

function generateGUID(){
    var l_guid = (S4() + S4() + "-" + S4() + "-4" + S4().substr(0,3) + "-" + S4() + "-" + S4() + S4() + S4()).toLowerCase();
    return l_guid;
}
function run(){
var l_guid = generateGUID();
var mod = parseInt(l_guid.split('-').pop(), 16) % 6;
console.log(mod);
}
run();
pending…

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

Compare results of other browsers

0 comments

Add a comment