From c68561d87dc3f8d703e8a2ddd6846d9a7c6ee2d6 Mon Sep 17 00:00:00 2001 From: "ben.nadler" Date: Mon, 12 Aug 2024 10:13:01 +0300 Subject: [PATCH] add performance --- TypeScript/app/gilded-rose.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/TypeScript/app/gilded-rose.ts b/TypeScript/app/gilded-rose.ts index db58d678..78161bef 100644 --- a/TypeScript/app/gilded-rose.ts +++ b/TypeScript/app/gilded-rose.ts @@ -67,3 +67,17 @@ export class GildedRose { return this.items; } } + +const startTime = performance.now(); + +// Call the function +const gildedRose = new GildedRose([]); +gildedRose.updateQuality(); + +// Record end time +const endTime = performance.now(); + +// Calculate the time difference +const timeTaken = endTime - startTime; + +console.log(`myFunction took ${timeTaken.toFixed(2)} ms to execute.`);