fast uid test (v2)

Revision 2 of this benchmark created on


Setup

var fastuid = () => ("00000" + (Math.random()*Math.pow(36,5) << 0).toString(36)).slice(-5);
    
    var fastuid2a = () =>fastuid()+fastuid()+fastuid()+fastuid()+fastuid()+fastuid()+fastuid()+fastuid();
    var fastuid2b = () =>Array.apply(null, Array(8)).map(String.prototype.valueOf,("00000" + (Math.random()*Math.pow(36,5) << 0).toString(36)).slice(-5));
    var fastuid3 = ()=>(1e40+'').replace(/[018]/g,a=>(a^Math.random()*16>>a/4).toString(16));

Test runner

Ready to run.

Testing in
TestOps/sec
fastuid2a()
fastuid2a();
ready
fastuid3()
fastuid3();
ready
fastuid2b()
fastuid2b();
ready

Revisions

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