| 58 | } |
| 59 | |
| 60 | function reportProfileResults(durations: number[], count: number) { |
| 61 | const totalDuration = durations.reduce((soFar: number, duration: number) => soFar + duration, 0); |
| 62 | const avgDuration = (totalDuration / count).toFixed(2); |
| 63 | const minDuration = durations |
| 64 | .reduce((soFar: number, duration: number) => Math.min(soFar, duration), Number.MAX_SAFE_INTEGER) |
| 65 | .toFixed(2); |
| 66 | window.console.log( |
| 67 | `Iterations: ${count}; cold time: ${durations[0].toFixed( |
| 68 | 2, |
| 69 | )} ms; average time: ${avgDuration} ms / iteration; best time: ${minDuration} ms`, |
| 70 | ); |
| 71 | } |
| 72 | |
| 73 | // helper script that will read out the url parameters |
| 74 | // and store them in appropriate form fields on the page |