Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
string.replace vs setUTCFullYear
(version: 1)
Comparing performance of:
replace vs setUTCFullYear
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const date = "2025-03-05"; const yearToReplaceWith = "2017";
Tests:
replace
const year = date.substring(0, 4); const newDate = date.replace(year, yearToReplaceWith);
setUTCFullYear
const dateDate = new Date(date); dateDate.setUTCFullYear(yearToReplaceWith); const newDate = dateDate.toISOString().substring(0, 10);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
replace
setUTCFullYear
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?