Script Preparation code:
AخA
 
var cookie = 'intercom-id-mrtzdw2q=c2be8491-1730-4343-b16e-1c708643318e; token=eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiIsImtpZCI6IjhjMTgyMTY1YWNmN2U3Yjg3NzkwNzcxNWFmZWRiNzhmIn0.e30.McvbBVzvGzsawYch7ToCgtCrUicIQZ3_wNBV93fVBMm90JTldSpzdDgXd0eY7au1AxQst08mH-7FVy4C8wr4EQ; intercom-session=acj; intercom-session-mq='
Tests:
  • Regexp

     
    const TOKEN_REGEXP = /token=(\S+)/
    const [, token] = TOKEN_REGEXP.exec(cookie)
    console.log(token)
  • Split

    x
     
    const token = cookie?.split('token=')[1]
        ? cookie.split('token=')[1].split(';')[0]
        : undefined
    console.log(token)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Regexp
    Split

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
Chrome 106 on Windows
View result in a separate tab
Test name Executions per second
Regexp 202318.1 Ops/sec
Split 192081.7 Ops/sec