From b4b41b1beb47d5dc0b8e246eebf836c076b64ea6 Mon Sep 17 00:00:00 2001 From: "LAPTOP-O016UC3M\\Qi Chen" <16399091+binaricat@users.noreply.github.com> Date: Wed, 10 Dec 2025 13:51:07 +0800 Subject: [PATCH] Improves terminal performance by tuning settings Disables cursor blinking, reduces scrollback buffer, and turns off smooth scrolling to lower rendering overhead. Increases debounce time for resize events to reduce unnecessary terminal reflows and improve UI responsiveness under load. --- components/Terminal.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/components/Terminal.tsx b/components/Terminal.tsx index 152107673..18365bb18 100644 --- a/components/Terminal.tsx +++ b/components/Terminal.tsx @@ -156,9 +156,11 @@ const TerminalComponent: React.FC = ({ if (disposed || !containerRef.current) return; const term = new GhosttyTerminal({ - cursorBlink: true, + cursorBlink: false, // Disable cursor blinking for better performance fontSize, fontFamily: '"JetBrains Mono", "Cascadia Code", "Fira Code", "SF Mono", "Menlo", "DejaVu Sans Mono", monospace', + scrollback: 5000, // Reduced from default 10000 for better performance + smoothScrollDuration: 0, // Disable smooth scrolling to reduce render overhead theme: { ...terminalTheme.colors, selectionBackground: terminalTheme.colors.selection, @@ -352,10 +354,10 @@ const TerminalComponent: React.FC = ({ if (resizeTimeout) { clearTimeout(resizeTimeout); } - // Wait 150ms after last resize event before fitting + // Wait 250ms after last resize event before fitting (increased for performance) resizeTimeout = setTimeout(() => { safeFit(); - }, 150); + }, 250); }); observer.observe(containerRef.current); @@ -372,7 +374,7 @@ const TerminalComponent: React.FC = ({ // Resizing just ended, fit the terminal const timer = setTimeout(() => { safeFit(); - }, 50); + }, 100); return () => clearTimeout(timer); } prevIsResizingRef.current = isResizing; @@ -396,10 +398,10 @@ const TerminalComponent: React.FC = ({ if (resizeTimeout) { clearTimeout(resizeTimeout); } - // Wait 150ms after last resize event before fitting + // Wait 250ms after last resize event before fitting (increased for performance) resizeTimeout = setTimeout(() => { safeFit(); - }, 150); + }, 250); }; window.addEventListener('resize', handler);