From 5bd49ded593c6c6900340c300ceeaaabb016cff8 Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 28 May 2024 18:40:22 +0100 Subject: [PATCH] Updated `SaveServer.load()` to log the total time taken to load profiles on server started instead of per profile --- project/src/servers/SaveServer.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/project/src/servers/SaveServer.ts b/project/src/servers/SaveServer.ts index 3b64303b..91f24fd4 100644 --- a/project/src/servers/SaveServer.ts +++ b/project/src/servers/SaveServer.ts @@ -66,10 +66,15 @@ export class SaveServer }); // load profiles + const start = performance.now(); + let loadTimeCount = 0; for (const file of files) { this.loadProfile(this.vfs.stripExtension(file)); + loadTimeCount += (performance.now() - start); } + + this.logger.debug(`${files.length} Profiles took: ${loadTimeCount.toFixed(2)}ms to load.`); } /** @@ -180,9 +185,7 @@ export class SaveServer if (this.vfs.exists(filePath)) { // File found, store in profiles[] - const start = performance.now(); this.profiles[sessionID] = this.jsonUtil.deserialize(this.vfs.readFile(filePath), filename); - this.logger.debug(`Profile: ${sessionID} took: ${(performance.now() - start).toFixed(2)}ms to load.`, true); } // Run callbacks