Skip to content

Commit 51e3935

Browse files
Revert "Add comprehensive performance diagnostics for macOS slowness debugging"
This reverts commit 3154fe2.
1 parent 513bebc commit 51e3935

3 files changed

Lines changed: 5 additions & 93 deletions

File tree

electron-app/main.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,11 @@ import {
2525
const __filename = fileURLToPath(import.meta.url);
2626
const __dirname = dirname(__filename);
2727

28-
// PERFORMANCE LOGGING: Track startup time
29-
const startupTime = Date.now();
30-
console.log('[PERF] App startup began');
31-
3228
init({
3329
dsn: 'https://6974b46329f24dc1b9fca4507c65e942@o361681.ingest.us.sentry.io/3956140',
3430
release: `v${pkg.version}`,
3531
});
3632

37-
console.log(`[PERF] Sentry initialized: +${Date.now() - startupTime}ms`);
38-
3933
const store = new Store({
4034
defaults: {
4135
firstRunV1: true,
@@ -82,7 +76,7 @@ const mb = menubar({
8276
width: 362,
8377
webPreferences: {
8478
contextIsolation: true,
85-
devTools: true,
79+
devTools: isDev,
8680
preload: join(__dirname, 'preload.js'),
8781
nodeIntegration: false,
8882
},
@@ -102,13 +96,6 @@ mb.app.commandLine.appendSwitch(
10296
);
10397
mb.app.commandLine.appendSwitch('ignore-certificate-errors', 'true');
10498

105-
// PERFORMANCE DIAGNOSTICS: Enable detailed logging in production
106-
if (!isDev) {
107-
mb.app.commandLine.appendSwitch('enable-logging');
108-
mb.app.commandLine.appendSwitch('v', '1');
109-
console.log('[PERF] Production logging enabled');
110-
}
111-
11299
let sharedPaletteLink: string | undefined;
113100

114101
async function openSharedPalette() {
@@ -178,8 +165,6 @@ mb.app.on('window-all-closed', () => {
178165
});
179166

180167
mb.on('after-create-window', () => {
181-
console.log(`[PERF] Window created: +${Date.now() - startupTime}ms`);
182-
183168
// Load the Ember application using our custom protocol/scheme
184169
handleFileUrls(emberAppDir);
185170

@@ -191,9 +176,7 @@ mb.on('after-create-window', () => {
191176
});
192177

193178
mb.window?.once('ready-to-show', function () {
194-
console.log(`[PERF] Window ready-to-show: +${Date.now() - startupTime}ms`);
195179
setTimeout(() => {
196-
console.log(`[PERF] Showing window: +${Date.now() - startupTime}ms`);
197180
void mb.showWindow();
198181
}, 750);
199182
});
@@ -231,8 +214,6 @@ mb.on('after-create-window', () => {
231214
});
232215

233216
mb.on('ready', () => {
234-
console.log(`[PERF] Menubar ready: +${Date.now() - startupTime}ms`);
235-
236217
ipcMain.on('enableDisableAutoStart', (event, openAtLogin) => {
237218
// Only allow auto-start in production
238219
if (!isDev) {

electron-app/src/ipc-events.ts

Lines changed: 4 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,12 @@ import { type Menubar } from 'menubar';
88
import { launchPicker } from './color-picker';
99
import { restartDialog } from './dialogs';
1010

11-
// PERFORMANCE LOGGING: Track first call vs subsequent calls
12-
const perfTracking = new Map<
13-
string,
14-
{ count: number; firstTime?: number; totalTime: number }
15-
>();
16-
17-
function trackPerf(eventName: string, fn: () => void | Promise<void>) {
18-
const start = Date.now();
19-
const stats = perfTracking.get(eventName) || { count: 0, totalTime: 0 };
20-
21-
const result = fn();
22-
23-
const duration = Date.now() - start;
24-
stats.count++;
25-
stats.totalTime += duration;
26-
27-
if (stats.count === 1) {
28-
stats.firstTime = duration;
29-
console.log(`[PERF] ${eventName} FIRST CALL: ${duration}ms`);
30-
} else {
31-
const avgOther =
32-
(stats.totalTime - (stats.firstTime || 0)) / (stats.count - 1);
33-
console.log(
34-
`[PERF] ${eventName} call #${stats.count}: ${duration}ms (first: ${stats.firstTime}ms, avg others: ${avgOther.toFixed(1)}ms)`
35-
);
36-
}
37-
38-
perfTracking.set(eventName, stats);
39-
return result;
40-
}
41-
4211
function setupEventHandlers(
4312
mb: Menubar,
4413
store: Store<{ firstRunV1: boolean; showDockIcon: boolean }>
4514
) {
46-
// Log all IPC messages for debugging
4715
ipcMain.on('copyColorToClipboard', (_channel, color: string) => {
48-
console.log('[IPC] Received: copyColorToClipboard');
49-
trackPerf('copyColorToClipboard', () => clipboard.writeText(color));
16+
clipboard.writeText(color);
5017
});
5118

5219
ipcMain.on('exitApp', () => mb.app.quit());
@@ -96,32 +63,15 @@ function setupEventHandlers(
9663
});
9764

9865
ipcMain.on('launchContrastBgPicker', () => {
99-
console.log('[IPC] Received: launchContrastBgPicker');
100-
void trackPerf('launchContrastBgPicker', () =>
101-
launchPicker(mb, 'contrastBg')
102-
);
103-
});
104-
105-
ipcMain.on('launchContrastFgPicker', () => {
106-
console.log('[IPC] Received: launchContrastFgPicker');
107-
void trackPerf('launchContrastFgPicker', () =>
108-
launchPicker(mb, 'contrastFg')
109-
);
110-
});
111-
112-
ipcMain.on('launchPicker', () => {
113-
console.log('[IPC] Received: launchPicker');
114-
void trackPerf('launchPicker', () => launchPicker(mb));
66+
void launchPicker(mb, 'contrastBg');
11567
});
11668

11769
ipcMain.on('launchContrastFgPicker', () => {
118-
void trackPerf('launchContrastFgPicker', () =>
119-
launchPicker(mb, 'contrastFg')
120-
);
70+
void launchPicker(mb, 'contrastFg');
12171
});
12272

12373
ipcMain.on('launchPicker', () => {
124-
void trackPerf('launchPicker', () => launchPicker(mb));
74+
void launchPicker(mb);
12575
});
12676

12777
ipcMain.handle('open-external', async (_event, url: string) => {

scripts/view-perf-logs.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)