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
Let's see, why modern code linting favors more to includes which claimed to be more "stable" they said.. hahahaha
// Shared test data
var supportedLocalesSmall = ['en', 'en-US', 'de', 'fr', 'it', 'es'];
var supportedLocalesLarge = [];
for (var i = 0; i < 10000; i++) {
supportedLocalesLarge.push('loc-' + i);
}
var hitLocaleSmall = 'fr';
var missLocaleSmall = 'jp';
var hitLocaleLarge = 'loc-9999';
var missLocaleLarge = 'loc-10001';
// Toggle which scenario you want to benchmark
// Uncomment ONE block at a time to keep results clean
// Small array - HIT
var supportedLocales = supportedLocalesSmall;
var locale = hitLocaleSmall;
// Small array - MISS
// var supportedLocales = supportedLocalesSmall;
// var locale = missLocaleSmall;
// Large array - HIT
// var supportedLocales = supportedLocalesLarge;
// var locale = hitLocaleLarge;
// Large array - MISS
// var supportedLocales = supportedLocalesLarge;
// var locale = missLocaleLarge;
Ready to run.
| Test | Ops/sec | |
|---|---|---|
| Array indexOf | | ready |
| Array includes | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.