patches: fix O(overlays) performance regression

Performance issue: editing large files (>~10KB, >2000 lines) caused
progressive slowdown regardless of VoiceOver status.

Root causes:
1. ns_zoom_find_overlay_candidate_line: called Foverlays_in on the
   entire visible buffer range on every redisplay when UAZoomEnabled().
   In files with many overlays (font-lock, hl-line, show-paren etc.)
   this was O(overlays) Lisp work per keystroke.

2. postAccessibilityNotificationsForFrame: when ns-accessibility-enabled
   is non-nil, checked BUF_OVERLAY_MODIFF every redisplay. font-lock
   bumps this on every redraw, triggering ns_ax_selected_overlay_text
   (another O(overlays) scan) for non-minibuffer windows.

Fix: Both scans now guard with MINI_WINDOW_P check. Overlay completion
frameworks (Vertico, Icomplete, Ivy) only display candidates in
minibuffer windows --- no completion framework puts selected-face
overlays in normal editing buffers. For non-minibuffer windows both
functions return immediately with zero Lisp calls.

Additionally: ns_zoom_find_child_frame_candidate is skipped when
f->child_frame_list is nil (no child frames = no Corfu popup).
This commit is contained in:
2026-03-01 04:26:12 +01:00
parent 84eb777065
commit 3d2fa7a54e
9 changed files with 87 additions and 69 deletions

View File

@@ -1,4 +1,4 @@
From 5d254e28a56e023b9bf1e46cf061b9d596f49b02 Mon Sep 17 00:00:00 2001
From 19a7509084e919d229267f835d86c31d97fb9784 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 5/9] ns: add interactive span elements for Tab navigation
@@ -17,10 +17,10 @@ Tested on macOS 14. Verified: Tab-cycling through org-mode links,
1 file changed, 286 insertions(+)
diff --git a/src/nsterm.m b/src/nsterm.m
index 41e8d4b..4692a58 100644
index d7e6660..7fc542b 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -9197,6 +9197,292 @@ - (NSRect)accessibilityFrame
@@ -9206,6 +9206,292 @@ - (NSRect)accessibilityFrame
@end