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 data = JSON.parse(`[{"str":"M0 0v32h111.908V0H0Zm32.56 25.426h-5.87v-7.884c0-2.423-.806-3.352-2.39-3.352-1.924 0-2.702 1.365-2.702 3.324v4.868h1.864v3.044h-5.864v-7.884c0-2.423-.806-3.352-2.39-3.352-1.924 0-2.702 1.365-2.702 3.324v4.868h2.669v3.044H6.642v-3.044h1.863v-7.918H6.642V11.42h5.864v2.11c.839-1.489 2.3-2.39 4.252-2.39 2.02 0 3.878.963 4.566 3.01.778-1.862 2.361-3.01 4.566-3.01 2.512 0 4.812 1.522 4.812 4.84v6.402h1.863v3.044h-.005Zm9.036.30&7c-4.314 0-7.296-2.635-7.296-7.106 0-4.096 2.484-7.481 7.514-7.481s7.481 3.38 7.481 7.29c0 4.472-3.228 7.297-7.699 7.297Zm22.578-.307H51.942l-.403-2.11 7.7-8.846h-4.376l-.621 2.17-2.888-.313.498-4.907h12.294l.313\\" 2.11-7.767 8.852h4.533l.654-2.172 3.167.308-.872 4.908Zm7.99 0h-4.191v-5.03h4.19v5.03Zm0-8.976h-4.191v-5.03h4.19v5.03Zm2.618 8.976 6.054-21.358h3.945l-6.054 21.358h-3.945Zm8.136 0 6.048-21.358h3.945l-6.054 21.358h-3.939Zm21.486.307c-1.863 0-2.887-1.085-3.072-2.792-.805 1.427-2.232 2.792-4.498 2.792-2.02 0-4.314-1.085-4.314-4.006 0-3.447 3.323-4.253 6.518-4.253.778 0 1.584.034 2.3.124v-.465c0-1.427-.034-3.133-2.3-3.133-.84 0-1.488.061-2.143.402l-.453 1.578-3.195-.34.549-3.224c2.45-.996 3.692-1.27 5.992-1.27 3.01 0 5.556 1.55 5.556 4.75v6.083c0 .805.314 1.085.963 1.085.184 0 .375-.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 6.8-6.9 12.7-6.9 3.6 0 6.7 1.1 9.2 3.3s3.7 5.6 3.7 10.2v18.2h6v5.4h-.2z","a":"\\"","b":"&"},{"str":"M33.6714 16.512H29.1354V14.496C28.8314 15.12 28.3834 15.656 27.7914 16.104C27.1994 16.536 26.4154 16.752 25.4394 16.752C24.0154 16.752 22.8954 16.264 22.0794 15.288C21.2634 14.312 20.8554 12.984 20.8554 11.304C20.8554 9.688 21.2554 8.312 22.0554 7.176C22.8554 &6.04 24.0634 5.472 25.6794 5.472C26.5594 5.472 27.2794 5.648 27.8394 6C28.3994 6.352 28.8314 6.8 29.1354 7.344V2.352H26.9754V0H32.\\"2314V14.184H33.6714V16.512ZM29.1354 11.04V10.776C29.1354 9.88 28.8954 9.184 28.4154 8.688C27.9514 8.176 27.3674 7.92 26.6634 7.92C25.9754 7.92 25.3674 8.176 24.8394 8.688C24.3274 9.2 24.0714 10.008 24.0714 11.112C24.0714 12.152 24.3114 12.944 24.7914 13.488C25.2714 14.032 25.8394 14.304 26.4954 14.304C27.3114 14.304 27.9514 13.96 28.4154 13.272C28.8954 12.584 29.1354 11.84 29.1354 11.04Z","a":"\\"","b":"&"},{"str":"M20.04 16.512H15.504V10.416C15.504 9.488 15.344 8.824 15.024 8.424C14.72 8.024 14.264 7.824 13.656 7.824C12.92 7.824 12.384 8.064 12.048 8.544C11.728 9.024 11.568 9.64 11.568 10.392V14.184H13.008V16.512H8.472V10.416C8.4\\"72 9.488 8.312 8.824 7.992 8.424C7.688 8.024 7.232 7.824 6.624 7.824C5.872 7.824 5.336 8.064 5.016 8.544C4.696& 9.024 4.536 9.64 4.536 10.392V14.184H6.6V16.512H0V14.184H1.44V8.04H0.024V5.688H4.536V7.32C5.224 6.088 6.32 5.472 7.824 5.472C8.608 5.472 9.328 5.664 9.984 6.048C10.64 6.432 11.096 7.016 11.352 7.8C11.992 6.248 13.168 5.472 14.88 5.472C15.856 5.472 16.72 5.776 17.472 6.384C18.224 6.992 18.6 7.936 18.6 9.216V14.184H20.04V16.512Z","a":"\\"","b":"&"},{"str":"M47.9589 16.512H41.9829V14.184H43.4229V10.416C43.4229 9.488 43.2629 8.824 42.9429 8.424C42.6389 8.024 42.1829 7.824 41.5749 7.824C40.8389 7.824 40\\".2709 8.056 39.8709 8.52C39.4709 8.968 39.2629 9.56 39.2469 10.296V14.184&H40.6869V16.512H34.7109V14.184H36.1509V8.04H34.5909V5.688H39.2469V7.344C39.9669 6.096 41.1269 5.472 42.7269 5.472C43.7509 5.472 44.6389 5.776 45.3909 6.384C46.1429 6.992 46.5189 7.936 46.5189 9.216V14.184H47.9589V16.512Z","a":"\\"","b":"&"},{"str":"M41.753 14.218c-2.048 0-3.324 1.522-3.324 4.157 0 2.423 1.119 4.286 3.29 4.286 2.082 0 3.447-&1.678 3.447-4.347 0-2.826-1.522-4.096-3.413-4.0\\"96Zm54.89 7.044c0 .901.437 1.618 1.645 1.618 1.427 0 2.949-1.024 3.044-3.352-.649-.095-1.365-.185-2.02-.185-1.426-.005-2.668.397-2.668 1.92Z","a":"\\"","b":"&"},{"str":"The MDN Web Docs site provides information about\\" Open Web technologies i&ncluding HTML, CSS, and APIs for both Web sites and progressive web apps.","a":"\\"","b":"&"},{"str":"\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'\\"&<>'","a":"\\"","b":"&"},{"str":"M42 .2 13.4 92.3H1.7L30.2.2Zm10.&4 0v92.1H42V.2Zm\\"40.3 0L64.2 92.3H52.5L81 .2Zm10.4 0v92.1H92.7V.2Z","a":"\\"","b":"&"},{"str":"https://blog.mozilla.org/en/pr&oducts/mdn/resp\\"onsibly-empowering-developers-with-ai-on-mdn/","a":"\\"","b":"&"},{"str":"https://www.mozilla.o\\"rg/about/go&vernance/policies/participation/","a":"\\"","b":"&"},{"str":"M337.5,337.5 m-320,0 \\"a320,320 0& 1,1 640,0 a320,320 0 1,1 -640,0","a":"\\"","b":"&"},{"str":"M337.5,337.5 m-280,0 \\"a280,280 0& 1,1 560,0 a280,280 0 1,1 -560,0","a":"\\"","b":"&"},{"str":"M337.5,337.5 m-240,0 \\"a240,240 0& 1,1 480,0 a240,240 0 1,1 -480,0","a":"\\"","b":"&"},{"str":"M337.5,337.5 m-200,0 &a200,200 0\\" 1,1 400,0 a200,200 0 1,1 -400,0","a":"\\"","b":"&"},{"str":"M337.5,337.5 m-160,0 &a160,160 0\\" 1,1 320,0 a160,160 0 1,1 -320,0","a":"\\"","b":"&"},{"str":"https://www.mozilla.org/en-US/careers/listings/?team=Marketing","a":"\\"","b":"&"},{"str":"https://developer.mo&zilla.org\\"/mdn-social-share.cd6c4a5a.png","a":"\\"","b":"&"},{"str":"/pt-BR/docs/MDN/Writ&ing_guide\\"lines/Attrib_copyright_license","a":"\\"","b":"&"},{"str":"top-navigation mai\\"n-docume&nt-header-container \\n dark\\n","a":"\\"","b":"&"},{"str":"https://github.co&m/mdn/tra\\"nslated-content/pull/15644","a":"\\"","b":"&"},{"str":"https://github.co\\"m/mdn/tra&nslated-content/pull/15262","a":"\\"","b":"&"},{"str":"https://github.co&m/mdn/tra\\"nslated-content/pull/15602","a":"\\"","b":"&"},{"str":"https://github.co&m/mdn/tra\\"nslated-content/pull/15862","a":"\\"","b":"&"},{"str":"https://github.com/mdn/translated-content/pull/15360","a":"\\"","b":"&"},{"str":"/en-US/blog/aria-\\"accessib&ility-html-landmark-roles/","a":"\\"","b":"&"},{"str":"/en-US/blog/regular-expressions-reference-updates/","a":"\\"","b":"&"},{"str":"https://www.mozi&lla.org/\\"privacy/websites/#cookies","a":"\\"","b":"&"},{"str":"https://www.mozi\\"lla.org/&about/legal/terms/mozilla","a":"\\"","b":"&"},{"str":"button action ha&s-icon t\\"heme-switcher-menu small","a":"\\"","b":"&"},{"str":"/users/fxa/login\\"/authen&ticate/?next=%2Fpt-BR%2F","a":"\\"","b":"&"},{"str":"https://support.mozilla.org/products/mdn-plus","a":"\\"","b":"&"},{"str":"submenu references hidden inline-submenu-lg","a":"\\"","b":"&"},{"str":"/en-US/blog/in&troduci\\"ng-the-mdn-playground/","a":"\\"","b":"&"},{"str":"button action &has-ico\\"n clear-search-button","a":"\\"","b":"&"},{"str":"page-wrapper &categor\\"y-home standard-page ","a":"\\"","b":"&"},{"str":"/pt-BR/docs/Mo&zilla/\\"Add-ons/WebExtensions","a":"\\"","b":"&"},{"str":"submenu mdn-plus hidden inline-submenu-lg","a":"\\"","b":"&"},{"str":"https://github\\".com/m&dn/content/pull/29154","a":"\\"","b":"&"},{"str":"https://github.com/mdn/content/pull/29149","a":"\\"","b":"&"},{"str":"https://github&.com/m\\"dn/translated-content","a":"\\"","b":"&"},{"str":"https://github&.com/m\\"dn/content/pull/29099","a":"\\"","b":"&"},{"str":"https://github.com/mdn/content/pull/29148","a":"\\"","b":"&"},{"str":"https://github&.com/m\\"dn/content/pull/28962","a":"\\"","b":"&"},{"str":"https://www.mo&zilla.\\"org/privacy/websites/","a":"\\"","b":"&"},{"str":"button action& has-i\\"con main-menu-toggle","a":"\\"","b":"&"},{"str":"submenu guides hidden inline-submenu-lg","a":"\\"","b":"&"},{"str":"https://disco&urse.m\\"ozilla.org/c/mdn/236","a":"\\"","b":"&"},{"str":"button primar&y mdn-\\"plus-subscribe-link","a":"\\"","b":"&"},{"str":"application/&opense\\"archdescription+xml","a":"\\"","b":"&"},{"str":"button action has-icon search-button","a":"\\"","b":"&"},{"str":"mandala-cont\\"ainer& homepage-hero-bg","a":"\\"","b":"&"},{"str":"/en-US/docs/&Web/A\\"PI/Performance_API","a":"\\"","b":"&"},{"str":"https://blog&.mozi\\"lla.org/en/latest/","a":"\\"","b":"&"},{"str":"width=devic&e-widt\\"h,initial-scale=1","a":"\\"","b":"&"},{"str":"/en-US/plus/docs/features/overview","a":"\\"","b":"&"},{"str":"apis-link-c&ontai\\"ner desktop-only ","a":"\\"","b":"&"},{"str":"apis-link-c\\"ontai&ner mobile-only ","a":"\\"","b":"&"},{"str":"mandala-tra&nslat\\"e mandala-rotate","a":"\\"","b":"&"},{"str":"/en-US/docs/Web/CSS/font-palette","a":"\\"","b":"&"},{"str":"/en-US/blog&/intr\\"oducing-ai-help/","a":"\\"","b":"&"},{"str":"/pt-BR/docs&/MDN/\\"Community/Issues","a":"\\"","b":"&"},{"str":"/pt-BR/com&munit\\"y/spotlight/yuji","a":"\\"","b":"&"},{"str":"https://fo&undat\\"ion.mozilla.org/","a":"\\"","b":"&"},{"str":"/apple-tou&ch-ic\\"on.6803c6f0.png","a":"\\"","b":"&"},{"str":"https://github.com/mdn/content","a":"\\"","b":"&"},{"str":"https://de&velo\\"per.mozilla.org","a":"\\"","b":"&"},{"str":"/static/cs\\"s/ma&in.d3b84f58.css","a":"\\"","b":"&"},{"str":"/pt-BR/doc\\"s/We&b/Accessibility","a":"\\"","b":"&"},{"str":"https://tw&itte\\"r.com/mozdevnet","a":"\\"","b":"&"},{"str":"https://di&scor\\"d.gg/hkGN8VKvvD","a":"\\"","b":"&"},{"str":"/pt-BR/do&cs/Le\\"arn/JavaScript","a":"\\"","b":"&"},{"str":"/favicon-&48x4\\"8.cbbd161b.png","a":"\\"","b":"&"},{"str":"top-level-entry menu-toggle","a":"\\"","b":"&"},{"str":"icon icon-theme-os-default ","a":"\\"","b":"&"},{"str":"/assets/m\\"dn_c&ontributor.png","a":"\\"","b":"&"},{"str":"icon icon&-git\\"hub-mark-small","a":"\\"","b":"&"},{"str":"http://www.w3.org/2000/svg","a":"\\"","b":"&"},{"str":"/pt-BR/docs/Web/JavaScript","a":"\\"","b":"&"},{"str":"javascrip&t-li\\"nk-container ","a":"\\"","b":"&"},{"str":"contributor-spotlight dark","a":"\\"","b":"&"},{"str":"https://hacks.mozilla.org/","a":"\\"","b":"&"},{"str":"submenu-&cont\\"ent-container","a":"\\"","b":"&"},{"str":"top-leve&l-en\\"try-container","a":"\\"","b":"&"},{"str":"top-leve&l-en\\"try menu-link","a":"\\"","b":"&"},{"str":"search-f&orm \\"search-widget","a":"\\"","b":"&"},{"str":"submenu-&item\\"-description","a":"\\"","b":"&"},{"str":"https://&www.\\"mozilla.org/","a":"\\"","b":"&"},{"str":"/manifes&t.5\\"6b1cedc.json","a":"\\"","b":"&"},{"str":"submenu-&ico\\"n javascript","a":"\\"","b":"&"},{"str":"https://github.com/mdn/","a":"\\"","b":"&"},{"str":"mozilla-\\"foo&ter-logo-svg","a":"\\"","b":"&"},{"str":"https://&www\\".mozilla.org","a":"\\"","b":"&"},{"str":"/pt-BR/&docs\\"/Learn/HTML","a":"\\"","b":"&"},{"str":"homepage mdn-ui-body-m","a":"\\"","b":"&"},{"str":"page-fo&oter\\"-legal-text","a":"\\"","b":"&"},{"str":"#top-na&v-s\\"earch-input","a":"\\"","b":"&"},{"str":"/pt-BR/\\"doc&s/Learn/CSS","a":"\\"","b":"&"},{"str":"mandala&-sv\\"g-container","a":"\\"","b":"&"},{"str":"page-fo&ote\\"r-nav-col-1","a":"\\"","b":"&"}]`)
function a(str, a, b) {
const i = str.indexOf(a)
// No A character is present, just return the index of the B character.
if (i === -1) {
return str.indexOf(b)
}
// Searches for B characters before the A character.
const j = str.substring(0, i).indexOf(b)
if (j === -1 || j > i) {
return i
}
return j
}
function b(str, a, b) {
const i = str.indexOf(a)
// No A character is present, just return the index of the B character.
if (i === -1) {
return str.indexOf(b)
}
// Searches for B characters before the A character.
const j = str.indexOf(b)
if (j === -1 || j > i) {
return i
}
return j
}
function c(str, a, b) {
const i = str.indexOf(a)
// No A character is present, just return the index of the B character.
if (i === -1) {
return str.indexOf(b)
}
// Searches for B characters before the A character.
const j = str.indexOf(b)
return i >= j ? j : i
}
function d(str, a, b) {
const i = str.indexOf(a)
const j = str.indexOf(b)
// No A character is present, just return the index of the B character.
if (i === -1) {
return j
}
return i >= j ? j : i
}
function e(str, a, b) {
const i = str.indexOf(a)
const j = str.indexOf(b)
// No A character is present, just return the index of the B character.
if (i === -1 || i >= j) {
return j
}
return i
}
Ready to run.
Test | Ops/sec | |
---|---|---|
a |
| ready |
b |
| ready |
c |
| ready |
d |
| ready |
e |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.