Script Preparation code:
AخA
 
var dateStr = "2021-08-10"
Tests:
  • split

     
    const [yyyy, mm, dd] = dateStr.split("/");
    const result =`${dd}/${mm}/${yyyy}`;
  • Date toLocaleString

     
    const result = new Date(dateStr).toLocaleString("pt-PT");
  • slice

     
    const day = dateStr.slice(8, 10);
    const month = dateStr.slice(5, 7);
    const year = dateStr.slice(0, 4);
  • substring

     
    const day = dateStr.substring(8, 10);
    const month = dateStr.substring(5, 7);
    const year = dateStr.substring(0, 4);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    split
    Date toLocaleString
    slice
    substring

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 25 days ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0
Chrome 134 on Windows
View result in a separate tab
Test name Executions per second
split 9273335.0 Ops/sec
Date toLocaleString 226367.2 Ops/sec
slice 57741608.0 Ops/sec
substring 59513728.0 Ops/sec