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 0e9726214f1081b8c4f23451ada5fc956042938b Mon Sep 17 00:00:00 2001
From 34602bfe4251677ac922f35cf02b3274c457d1d7 Mon Sep 17 00:00:00 2001
From: Martin Sukany <martin@sukany.cz>
Date: Sat, 28 Feb 2026 12:58:11 +0100
Subject: [PATCH 2/9] ns: add accessibility base classes and text extraction
@@ -188,7 +188,7 @@ index ea6e7ba..6e830de 100644
diff --git a/src/nsterm.m b/src/nsterm.m
index 2dd79ca..b4437f1 100644
index eee4cd9..28ee1d5 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -46,6 +46,7 @@ Updated by Christian Limpach (chris@nice.ch)
@@ -199,7 +199,7 @@ index 2dd79ca..b4437f1 100644
#include "systime.h"
#include "character.h"
#include "xwidget.h"
@@ -7133,6 +7134,430 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
@@ -7142,6 +7143,430 @@ - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg
}
#endif
@@ -630,7 +630,7 @@ index 2dd79ca..b4437f1 100644
/* ==========================================================================
EmacsView implementation
@@ -11592,6 +12017,28 @@ Convert an X font name (XLFD) to an NS font name.
@@ -11601,6 +12026,28 @@ Convert an X font name (XLFD) to an NS font name.
DEFSYM (Qns_drag_operation_generic, "ns-drag-operation-generic");
DEFSYM (Qns_handle_drag_motion, "ns-handle-drag-motion");
@@ -659,7 +659,7 @@ index 2dd79ca..b4437f1 100644
Fput (Qalt, Qmodifier_value, make_fixnum (alt_modifier));
Fput (Qhyper, Qmodifier_value, make_fixnum (hyper_modifier));
Fput (Qmeta, Qmodifier_value, make_fixnum (meta_modifier));
@@ -11740,6 +12187,15 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
@@ -11749,6 +12196,15 @@ Nil means use fullscreen the old (< 10.7) way. The old way works better with
This variable is ignored on Mac OS X < 10.7 and GNUstep. */);
ns_use_srgb_colorspace = YES;