regex vs split routing

Benchmark created on


Preparation HTML

<script>
  function getUrlSegmentsBySplit(path) {
    var chunks = path.split('/').slice(1);

    return chunks;
  }

  function getUrlSegmentsByRegex(path) {
    var chunks = path.match(/([^/]+)/g)
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
String split URL Path
getUrlSegmentsBySplit("/short/url/test")
ready
String split long URL Path
getUrlSegmentsBySplit("/this/is/a/longer/url/test/right")
ready
Regex split short URL Path
getUrlSegmentsByRegex("/short/url/test")
ready
Regex split long URL Path
getUrlSegmentsByRegex("/this/is/a/longer/url/test/right")
ready

Revisions

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

  • Revision 1: published on
  • Revision 2: published by Aaron Hale on
  • Revision 3: published by Bernice Greene on
  • Revision 5: published by dota 2 items hack on
  • Revision 6: published by Randolph on
  • Revision 7: published by Annabelle Streaming Vf on
  • Revision 8: published by Annabelle Streaming Vf on
  • Revision 9: published by Annabelle Streaming Film on
  • Revision 10: published by Ada on
  • Revision 12: published by Fury film en streaming on
  • Revision 13: published by install whatsapp on pc on