jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
must count words, lines and chars (except \n)
function Reader(){
this.txt = "Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. \nDe carne lumbering animata corpora quaeritis. \nSummus brains sit, morbo vel maleficia? \nDe apocalypsi gorger omero undead survivor dictum mauris. \nHi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. \nQui animated corpse, cricket bat max brucks terribilem incessu zomby. \nThe voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. \nZonbi tattered for solum oculi eorum defunctis go lum cerebro. \n Nescio brains an Undead zombies. \nSicut malus putrid voodoo horror. \nNigh tofth eliv ingdead.\n\nCum horribilem walking dead resurgere de crazed sepulcris creaturis, zombie sicut de grave feeding iride et serpens. \n Pestilentia, shaun ofthe dead scythe animated corpses ipsa screams. \nPestilentia est plague haec decaying ambulabat mortuos. \nSicut zeder apathetic malus voodoo. \nAenean a dolor plan et terror soulless vulnerum contagium accedunt, mortui iam vivam unlife. \nQui tardius moveri, brid eof reanimator sed in magna copia sint terribiles undeath legionis. \nAlii missing oculis aliorum sicut serpere crabs nostram. \n Putridi braindead odores kill and infect, aere implent left four dead.";
this.chunks= [];
var str = this.txt,
cut ='',
pos = 0;
while (str !=='')
{
pos = str.length <10 ? str.length : Math.floor( (Math.random() * str.length/2) );
cut = str.slice(0, pos+1);
str = str.slice(pos, str.length);
// console.log(str, str.length, pos);
this.chunks.push(cut);
}
this.chunks.reverse();
this.count = 0;
}
Reader.prototype.getChunk = function(){
return this.count++ == this.chunks.length ? '' : this.chunks[this.chunks.length-this.count];
}
var r = new Reader();
/*['stef', 'christianhammer'].forEach(function(v){
if(window[v].lineCount !== 20 ||
window[v].wordCount !== 176 ||
window[v].charCount !== 1231 ){
throw new Error('"' + v + '" results are wrong!! : '+
'l:'+ window[v].lineCount +'/20;' +
' w:'+ window[v].wordCount +'/176;' +
' c:'+ window[v].charCount +'/1231;' +)
}
});*/
Ready to run.
Test | Ops/sec | |
---|---|---|
Stef |
| ready |
christianhammer |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.