RegExp 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

  • RegExp split

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

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