new Url vs host RegEx test

5 months ago
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Test name Executions per second
new URL 1135990.8 Ops/sec
RegEx 17273946.0 Ops/sec
Tests:
  • new URL

    AخA
     
    return new URL('https://is5-ssl.mzstatic.com/image/thumb/Purple126/v4/00/33/2e/00332e58-b196-82cf-1231-82d81d6fe477/AppIcon_TikTok-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/512x0w.png').origin;
  • RegEx

     
    return 'https://is5-ssl.mzstatic.com/image/thumb/Purple126/v4/00/33/2e/00332e58-b196-82cf-1231-82d81d6fe477/AppIcon_TikTok-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/512x0w.png'.match(/^(?:(?:http|ftp|https):\/\/)?((?:[\w.-]*)\.(?:[\w]*))/)[0]
Open this result on MeasureThat.net