Last active
August 17, 2020 06:59
-
-
Save harshithjv/84f2f18b381767a4c2f642f70acaeca9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iters = 100000 # limit I reached on firefox: 500000 | |
| # limit I reached on chrome : 125838 | |
| subsPerfTable = []; | |
| [...Array(iters).keys()].forEach(() => { | |
| a = performance.now(); | |
| "2020-08-10".substring(0,10) === "2020-08-10T00:00:55Z".substring(0,10); | |
| b = performance.now(); | |
| subsPerfTable.push(b-a); | |
| }); | |
| datePerfTable = []; | |
| [...Array(iters).keys()].forEach(() => { | |
| a = performance.now(); | |
| (new Date("2020-08-10").setHours(0,0,0,0)) === (new Date("2020-08-10T00:00:55Z").setHours(0,0,0,0)); | |
| b = performance.now(); | |
| datePerfTable.push(b-a); | |
| }); | |
| console.log("substr"); | |
| console.log("Min: ", Math.min(...subsPerfTab)); | |
| console.log("Max: ", Math.max(...subsPerfTab)); | |
| console.log("Total: ", subsPerfTable.reduce((a, b) => a + b)); | |
| console.log("Average: ", subsPerfTable.reduce((a, b) => a + b) / iters); | |
| console.log("---------------------------------------------"); | |
| console.log("date"); | |
| console.log("Min: ", Math.min(...datePerfTab)); | |
| console.log("Max: ", Math.max(...datePerfTab)); | |
| console.log("Total: ", datePerfTable.reduce((a, b) => a + b)); | |
| console.log("Average: ", datePerfTable.reduce((a, b) => a + b) / iters); | |
| console.log("---------------------------------------------"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment