()
| 34 | } |
| 35 | |
| 36 | async function benchmark() { |
| 37 | // warmup |
| 38 | await route(waypoints); |
| 39 | |
| 40 | const performanceHistorgram = createHistogram(); |
| 41 | |
| 42 | for (let i = 0; i < 1000; i++) { |
| 43 | const start = performance.now(); |
| 44 | await route(waypoints); |
| 45 | const end = performance.now(); |
| 46 | // record result in microseconds |
| 47 | performanceHistorgram.record(Math.ceil((end - start) * 1000)); |
| 48 | } |
| 49 | |
| 50 | |
| 51 | console.log(performanceHistorgram); |
| 52 | } |
| 53 | benchmark(); |