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
This test compares to common alternatives when trying to find out if a given item is part of a list.
To read the results, compare each "pair" of tests, i.e. "Array success" vs. "RegExp success" vs. "String success", then "Array fail", then "RegExp fail" vs. "String fail" and so on.
var str = "Lorizzle go to hizzle ass sit fo shizzle, sure adipiscing break yo neck, yall. Nullam sapien shiznit, we gonna chung volutpizzle, suscipit pimpin', gravida boom shackalack, arcu. The bizzle pizzle black. Boofron erizzle. For sure izzle brizzle dapibizzle that's the shizzle tempus fo shizzle my nizzle. Maurizzle dope nibh izzle hizzle. Fizzle izzle you son of a bizzle. Pellentesque shit daahng dawg nisi. In boofron platea dictumst. Donec dapibizzle. Fo shiznit, pretizzle funky fresh, mattizzle ac, eleifend vitae, nunc. I saw beyonces tizzles and my pizzle went crizzle suscipit. Integizzle owned velizzle sed purus.";
var arr = str.split(" ");
var arrShort = ["foo", "bar", "baz"];
var strShort = "foo bar baz";
var toFind = "izzle";
var toFail = "uzzle";
var toFindShort = "bar"
var toFailShort = "boo";
var reFind = /(?:^| )izzle(?: |$)/;
var reFail = /(?:^| )uzzle(?: |$)/;
var reFindShort = /(?:^| )bar(?: |$)/;
var reFailShort = /(?:^| )boo(?: |$)/;
Ready to run.
Test | Ops/sec | |
---|---|---|
Array success |
| ready |
RegExp success |
| ready |
String success |
| ready |
Array fail |
| ready |
RegExp fail |
| ready |
String fail |
| ready |
Short Array success |
| ready |
Short RegExp success |
| ready |
Short String success |
| ready |
Short Array fail |
| ready |
Short RegExp fail |
| ready |
Short String fail |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.