From 942dac4be009aa37ff201af3a6b9a4de615d04cb Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 16 Sep 2024 15:26:01 +0800 Subject: [PATCH] Let's benchmark deeper --- src/utils/api.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/api.js b/src/utils/api.js index 78674a26..7e5b52d7 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -60,6 +60,7 @@ export function initClient({ instance, accessToken }) { // Get the instance information // The config is needed for composing export async function initInstance(client, instance) { + __BENCHMARK.start('init-instance'); console.log('INIT INSTANCE', client, instance); const { masto, accessToken } = client; // Request v2, fallback to v1 if fail @@ -111,6 +112,7 @@ export async function initInstance(client, instance) { // masto.ws = streamClient; console.log('🎏 Streaming API client:', client); } + __BENCHMARK.end('init-instance'); } // Get the account information and store it @@ -131,6 +133,7 @@ export async function initAccount(client, instance, accessToken, vapidKey) { // Get preferences export async function initPreferences(client) { + __BENCHMARK.start('init-preferences'); try { const { masto } = client; const preferences = await masto.v1.preferences.fetch(); @@ -139,6 +142,7 @@ export async function initPreferences(client) { // silently fail console.error(e); } + __BENCHMARK.end('init-preferences'); } // Get the masto instance