Regex split vs String split

Edit on GitHub

Setup

var myBigString = "Merged pull request #1920 from example/example\n\nMade some use of a JavaScript performance benchmark;

Tests

  • Regex split

    myBigString.split(/\n/g)[0]
  • String split

    myBigString.split('\n')[0]