GNU logs - #79933, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#79933: [PATCH] Improve performance of 'flyspell-goto-next-error'
Resent-From: Kristoffer Balintona <krisbalintona@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 02 Dec 2025 02:11:02 +0000
Resent-Message-ID: <handler.79933.B.176464141923272 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 79933
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: 79933 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.176464141923272
          (code B ref -1); Tue, 02 Dec 2025 02:11:02 +0000
Received: (at submit) by debbugs.gnu.org; 2 Dec 2025 02:10:19 +0000
Received: from localhost ([127.0.0.1]:54821 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vQFqM-00063H-RF
	for submit <at> debbugs.gnu.org; Mon, 01 Dec 2025 21:10:19 -0500
Received: from lists.gnu.org ([2001:470:142::17]:52202)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <krisbalintona@HIDDEN>)
 id 1vQFqK-00060Q-77
 for submit <at> debbugs.gnu.org; Mon, 01 Dec 2025 21:10:16 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <krisbalintona@HIDDEN>)
 id 1vQFqC-0003ge-Jy
 for bug-gnu-emacs@HIDDEN; Mon, 01 Dec 2025 21:10:08 -0500
Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <krisbalintona@HIDDEN>)
 id 1vQFqA-0001QO-MF
 for bug-gnu-emacs@HIDDEN; Mon, 01 Dec 2025 21:10:08 -0500
Received: by mail-ed1-x529.google.com with SMTP id
 4fb4d7f45d1cf-640aaa89697so7123900a12.3
 for <bug-gnu-emacs@HIDDEN>; Mon, 01 Dec 2025 18:10:04 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1764641402; x=1765246202; darn=gnu.org;
 h=to:subject:message-id:date:mime-version:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=Xw+nG+Osu2a0T1sAu+XOtJlmKklzWYjnZM0bFW00kWM=;
 b=X6If9Q2QdOuIFphm6Kkpz7EEFqzNpwVBaoTKYIwENR3VQAbEYSnvmDyzY/Th5QyKC8
 roMJunXdZAY9x6vWgBQj/zByrSwLVUKrGyhcRjMYBDS4D5y2eIob6NkgYPosCbQBa1Ny
 WOXZCRkRzPudBSRXWCQO0ctPAOmhIB0Yh6qx7q9WJMqIDogoHv+XYeofFUe5vy17cjqD
 DPK6d1M1DtuxuwoFW2JO/jYZjizCnE99lZiTi5K6u67d+NW9rDvILowxVNqvSYds/bWG
 EEa9iNIHDeByCyQog/dXwaVP5SLEh76I4p1sUU/7fs76lMGNRvIC5v4XF3Nto5nr8Lrv
 egQQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1764641402; x=1765246202;
 h=to:subject:message-id:date:mime-version:from:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=Xw+nG+Osu2a0T1sAu+XOtJlmKklzWYjnZM0bFW00kWM=;
 b=RoJ2/3Ka1EofGtLFbjwiUFWzRprZ9dlOrVzE3dWKa/rnxnF6t0FbKu6KxRVxbiUMOc
 MA4r7NY88QMrldbtIPmFr25kbJmph3hJcOMfZdH9LriLSQNbQYp/weP7ytAcjMesNvuQ
 tj+ds9VeXtXw1UKDx3ibY/9tcqyLm6jn0ieRGiXlCn9I5hV/0G+JHF6enscDQtiynTPd
 yRhXyBGoDLA1EavJ6/ZzXIJs8qxmoxCuOnemvScAnPFRKqAutbSOO1w0cCp3reou0BZ6
 mlMWJG+E/iJd8JKas384oVQMt5DiUQfk+IYZzTXLbwNqH4xXfyRJI7/hZZdmX+xq/Tcz
 GoIg==
X-Gm-Message-State: AOJu0YyGcTJITYVjr2S1upvNXdD7GFPWgnHDarNZu6aabpaoqDvRMHdq
 a25cTrkrw0lxzVOkW1F6Nnl9S8HfpG5k6l9adNurk607QCJQU1O8LI0sV37ncKd4HYRVlOuH7dy
 HIU/mp2GELqlRd9xgvWbFKqsAjogO4883xaOP
X-Gm-Gg: ASbGncuKfOa+wH363xI5i2EdCMCKiE4EX2+xdNHJjHoJy2e1MMX1jRxIDeSczwtctX1
 LRaXPbrWNXH6wBDkHGdl+gI3iVvmFIJ9gCQC38BZJAqQ5sfZ257BUlFziXZ7L+IxrFI4lXp6cYK
 7h/d1dc0PHCx7SnMYN7bNaqMECIOwJn5vEQiVowUTU6gMswaMxTRBMm+0shoDYjSZKnambUoQkh
 jyql9ZKx01zdAUkRnZMsSO86ohVopSNovqwyZ0I6zgmEZ8ImSBowex2dodVxS2IC98XdmM=
X-Google-Smtp-Source: AGHT+IHzmkjIOiTPS7Ek3Xwt01Sl+XefwOrCrlcJAHCMiBzFgUxJ3PaqS4nHAgo2+j5A/B/Mf9QvTXX6xe4ZvduqhLI=
X-Received: by 2002:a05:6402:40cc:b0:640:b978:efdb with SMTP id
 4fb4d7f45d1cf-6455469c11dmr34722414a12.25.1764641402422; Mon, 01 Dec 2025
 18:10:02 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Mon, 1 Dec 2025 21:10:00 -0500
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Mon, 1 Dec 2025 21:10:00 -0500
From: Kristoffer Balintona <krisbalintona@HIDDEN>
MIME-Version: 1.0
Date: Mon, 1 Dec 2025 21:10:00 -0500
X-Gm-Features: AWmQ_bmirUOy4HVuoCTUA5BbPuBVpzzmCgPvzJ2uscW6g3YPpQTWZm26Zxsd9m8
Message-ID: <CANVbq5n2_P6yfN+SK7riDVN4eyfoBh-jaAjtAzJLGjNsf8SFUA@HIDDEN>
Content-Type: multipart/mixed; boundary="000000000000f2bb600644ee97fb"
Received-SPF: pass client-ip=2a00:1450:4864:20::529;
 envelope-from=krisbalintona@HIDDEN; helo=mail-ed1-x529.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--000000000000f2bb600644ee97fb
Content-Type: text/plain; charset="UTF-8"

Tags: patch

Hello,

I've attached that improves the performance of
`flyspell-goto-next-error' significantly by having it use
`previous-overlay-change' and `next-overlay-change' instead of calling
`flyspell-overlay-p' on every character until it finds a misspelling.

Here's a quick, naive benchmark on a semi-large file of mine with many
misspellings:

    (benchmark-run 10
      (save-excursion
        (goto-char (point-min))
        (while (not (eobp))
          (flyspell-goto-next-error))))
    ;; Before: (13.282584424 0 0.0)
    ;; After: (0.319260975 0 0.0)

This probably won't be too noticeable to a human when a user calls the
command once, but on repeat calls on a large buffer it might be.

For future reference, are mini-refactoring patches without performance
gains welcome? I have been trying to see if I can improve flyspell
performance and would like to know what is acceptable as a patch.


In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.49, cairo version 1.18.4)
Windowing system distributor 'Microsoft Corporation', version 11.0.12010000
System Description: Arch Linux

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/9pi8kah55s964qfik4cqysjdq74ll4sv-bash-minimal-5.2.37/bin/bash
 SHELL=/gnu/store/9pi8kah55s964qfik4cqysjdq74ll4sv-bash-minimal-5.2.37/bin/bash
 --prefix=/gnu/store/6w3c8fi1yvjahq0biv8bxjf0kgjzaici-emacs-master-31.0.50-1.11b68c6
 --enable-fast-install
 --docdir=/gnu/store/qk5y2mpib8qykghqff30lndjn6v5vvng-emacs-master-31.0.50-1.11b68c6-doc/share/doc/emacs-master-31.0.50
 --with-cairo --with-modules --with-native-compilation=aot 'CFLAGS=-g
 -O2 -Wno-error=incompatible-pointer-types' --disable-build-details'

--000000000000f2bb600644ee97fb
Content-Type: text/plain; charset="US-ASCII"
Content-Disposition: attachment
Content-Transfer-Encoding: base64
X-Attachment-Id: 4082f00b1f823c4b_0.2

Ci0tIApLaW5kIHJlZ2FyZHMsCktyaXN0b2ZmZXIK
--000000000000f2bb600644ee97fb
Content-Type: text/x-patch; charset="US-ASCII"; 
	name="0001-Improve-performance-of-flyspell-goto-next-error.patch"
Content-Disposition: attachment; 
	filename="0001-Improve-performance-of-flyspell-goto-next-error.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: 4082f00b1f823c4b_0.1

RnJvbSAzNGZmOTkzOWZiNjc3OWU4NTI2OTM5Mzk3MmY5Njg5ODIxYzVhZGI1IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBLcmlzdG9mZmVyIEJhbGludG9uYSA8a3Jpc2JhbGludG9uYUBn
bWFpbC5jb20+CkRhdGU6IFdlZCwgMjYgTm92IDIwMjUgMDg6MDQ6MjIgLTA2MDAKU3ViamVjdDog
W1BBVENIIDEvMV0gSW1wcm92ZSBwZXJmb3JtYW5jZSBvZiAnZmx5c3BlbGwtZ290by1uZXh0LWVy
cm9yJwoKKiBsaXNwL3RleHRtb2Rlcy9mbHlzcGVsbC5lbCAoZmx5c3BlbGwtZ290by1uZXh0LWVy
cm9yKTogVXNlCiduZXh0LW92ZXJsYXktY2hhbmdlJyBhbmQgJ3ByZXZpb3VzLW92ZXJsYXktY2hh
bmdlJy4KLS0tCiBsaXNwL3RleHRtb2Rlcy9mbHlzcGVsbC5lbCB8IDE0ICsrKystLS0tLS0tLS0t
CiAxIGZpbGUgY2hhbmdlZCwgNCBpbnNlcnRpb25zKCspLCAxMCBkZWxldGlvbnMoLSkKCmRpZmYg
LS1naXQgYS9saXNwL3RleHRtb2Rlcy9mbHlzcGVsbC5lbCBiL2xpc3AvdGV4dG1vZGVzL2ZseXNw
ZWxsLmVsCmluZGV4IGQ2MmMzZmQxMzVkLi5hYzgwNjFlNjVkZCAxMDA2NDQKLS0tIGEvbGlzcC90
ZXh0bW9kZXMvZmx5c3BlbGwuZWwKKysrIGIvbGlzcC90ZXh0bW9kZXMvZmx5c3BlbGwuZWwKQEAg
LTE3NDgsMTcgKzE3NDgsMTEgQEAgRkxZU1BFTEwtQlVGRkVSLiIKICAgICAgIChzZXRxIHBvcyAo
cG9pbnQpKSkKICAgICA7OyBTZWVrIHRoZSBuZXh0IGVycm9yLgogICAgICh3aGlsZSAoYW5kICgv
PSBwb3MgbWF4KQotCQkobGV0ICgob3ZzIChvdmVybGF5cy1hdCBwb3MpKQotCQkgICAgICAociAn
KCkpKQotCQkgICh3aGlsZSAoYW5kIChub3QgcikgKGNvbnNwIG92cykpCi0JCSAgICAoaWYgKGZs
eXNwZWxsLW92ZXJsYXktcCAoY2FyIG92cykpCi0JCQkoc2V0cSByIHQpCi0JCSAgICAgIChzZXRx
IG92cyAoY2RyIG92cykpKSkKLQkJICAobm90IHIpKSkKLSAgICAgIChzZXRxIHBvcyAoaWYgcHJl
dmlvdXMgKDEtIHBvcykgKDErIHBvcykpKSkKKyAgICAgICAgICAgICAgICAoc2V0cSBwb3MgKGlm
IHByZXZpb3VzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocHJldmlvdXMtb3Zlcmxh
eS1jaGFuZ2UgcG9zKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIChuZXh0LW92ZXJsYXkt
Y2hhbmdlIHBvcykpKQorICAgICAgICAgICAgICAgIChub3QgKGFueSAjJ2ZseXNwZWxsLW92ZXJs
YXktcCAob3ZlcmxheXMtYXQgcG9zKSkpKSkKICAgICAoZ290by1jaGFyIHBvcykKLSAgICAod2hl
biBwcmV2aW91cwotICAgICAgKGZvcndhcmQtd29yZCAtMSkpCiAgICAgOzsgU2F2ZSB0aGUgY3Vy
cmVudCBsb2NhdGlvbiBmb3IgbmV4dCBpbnZvY2F0aW9uLgogICAgIChzZXRxIGZseXNwZWxsLW9s
ZC1wb3MtZXJyb3IgKHBvaW50KSkKICAgICAoc2V0cSBmbHlzcGVsbC1vbGQtYnVmZmVyLWVycm9y
IChjdXJyZW50LWJ1ZmZlcikpCi0tIAoyLjUyLjAKCg==
--000000000000f2bb600644ee97fb--




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Kristoffer Balintona <krisbalintona@HIDDEN>
Subject: bug#79933: Acknowledgement ([PATCH] Improve performance of
 'flyspell-goto-next-error')
Message-ID: <handler.79933.B.176464141923272.ack <at> debbugs.gnu.org>
References: <CANVbq5n2_P6yfN+SK7riDVN4eyfoBh-jaAjtAzJLGjNsf8SFUA@HIDDEN>
X-Gnu-PR-Message: ack 79933
X-Gnu-PR-Package: emacs
X-Gnu-PR-Keywords: patch
Reply-To: 79933 <at> debbugs.gnu.org
Date: Tue, 02 Dec 2025 02:11:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 79933 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
79933: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D79933
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#79933: [PATCH] Improve performance of 'flyspell-goto-next-error'
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 02 Dec 2025 15:14:02 +0000
Resent-Message-ID: <handler.79933.B79933.176468842321973 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79933
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Kristoffer Balintona <krisbalintona@HIDDEN>
Cc: 79933 <at> debbugs.gnu.org
Received: via spool by 79933-submit <at> debbugs.gnu.org id=B79933.176468842321973
          (code B ref 79933); Tue, 02 Dec 2025 15:14:02 +0000
Received: (at 79933) by debbugs.gnu.org; 2 Dec 2025 15:13:43 +0000
Received: from localhost ([127.0.0.1]:60318 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vQS4V-0005iK-8O
	for submit <at> debbugs.gnu.org; Tue, 02 Dec 2025 10:13:43 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:46430)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vQS4S-0005i4-Gw
 for 79933 <at> debbugs.gnu.org; Tue, 02 Dec 2025 10:13:41 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1vQS4N-0003o5-5R; Tue, 02 Dec 2025 10:13:35 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=v8gQfnaeXFTZ9z8u0Kw93jdZpVfaWzSGi/HEW8diYtg=; b=RA9LFDj9Ogcu
 PdcQ6QVuHqUltRh+CkbF3Zov8VPrzD4rXL4oiVL5AZ3qo0dWZEsCApVdT6xgZ3deHVk8R0AEA2elU
 UrLzm0Y2i1HdT0Mncev5VOAN/33/1ih/HhnNICr0CCo6WuBH52x9ibUbyuKAO2miC+JGKIBCy6r+S
 zlIExWYYp1PNb6M9EmBq8+/2HRNsm89Qo7AzsC/cqftPhpPct4iAsRYZpsIh40a3l60CTGcqvS6IV
 3uXMK42yYt4areYGnrkILam4kFWokRpoSs+AVjuG7L4E1cNvS+Io8b1EV7Z9Yuqqk/EV+lWU8BVva
 2OsGtH0Ws20UQKNnURXdXg==;
Date: Tue, 02 Dec 2025 17:13:32 +0200
Message-Id: <86v7io3oir.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <CANVbq5n2_P6yfN+SK7riDVN4eyfoBh-jaAjtAzJLGjNsf8SFUA@HIDDEN>
 (message from Kristoffer Balintona on Mon, 1 Dec 2025 21:10:00 -0500)
References: <CANVbq5n2_P6yfN+SK7riDVN4eyfoBh-jaAjtAzJLGjNsf8SFUA@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Kristoffer Balintona <krisbalintona@HIDDEN>
> Date: Mon, 1 Dec 2025 21:10:00 -0500
> 
> I've attached that improves the performance of
> `flyspell-goto-next-error' significantly by having it use
> `previous-overlay-change' and `next-overlay-change' instead of calling
> `flyspell-overlay-p' on every character until it finds a misspelling.
> 
> Here's a quick, naive benchmark on a semi-large file of mine with many
> misspellings:
> 
>     (benchmark-run 10
>       (save-excursion
>         (goto-char (point-min))
>         (while (not (eobp))
>           (flyspell-goto-next-error))))
>     ;; Before: (13.282584424 0 0.0)
>     ;; After: (0.319260975 0 0.0)

Thanks, this is a good improvement.

However, it doesn't only replace one-position-at-a-time test with
next/previous-overlay-change, it also uses 'any' instead of the
explicit loop in the original implementation.  And I wonder whether
'any', given its more general implementation, might be slower of that
original loop?  Or maybe it's faster?  Did you test that aspect?

> For future reference, are mini-refactoring patches without performance
> gains welcome?

IMO, only if they significantly simplify the code or make it
significantly easier to understand and maintain, and not just for the
person who does the refactoring.

> I have been trying to see if I can improve flyspell
> performance and would like to know what is acceptable as a patch.

Performance improvements are always welcome, unless they make the code
much more complex and hard to understand.  But even then it could be
acceptable if the performance gains are huge.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#79933: [PATCH] Improve performance of 'flyspell-goto-next-error'
Resent-From: Kristoffer Balintona <krisbalintona@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 02 Dec 2025 21:14:02 +0000
Resent-Message-ID: <handler.79933.B79933.176471002718242 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79933
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 79933 <at> debbugs.gnu.org
Received: via spool by 79933-submit <at> debbugs.gnu.org id=B79933.176471002718242
          (code B ref 79933); Tue, 02 Dec 2025 21:14:02 +0000
Received: (at 79933) by debbugs.gnu.org; 2 Dec 2025 21:13:47 +0000
Received: from localhost ([127.0.0.1]:34195 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vQXgx-0004k8-9U
	for submit <at> debbugs.gnu.org; Tue, 02 Dec 2025 16:13:47 -0500
Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]:53479)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <krisbalintona@HIDDEN>)
 id 1vQXgv-0004ji-6Q
 for 79933 <at> debbugs.gnu.org; Tue, 02 Dec 2025 16:13:46 -0500
Received: by mail-lf1-x12b.google.com with SMTP id
 2adb3069b0e04-5957f617ff0so6829792e87.2
 for <79933 <at> debbugs.gnu.org>; Tue, 02 Dec 2025 13:13:45 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1764710019; x=1765314819; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=6bp70/zB7s9JIMppGbfFSoteuS66DBzS5DiehnwaNAM=;
 b=KK6EqQ8LMzFHslZBow87DEqb0pKydazx3KbFgB98jJPiAHCS8yAE4I03fividlerE4
 OtuqMQrsLSAvrQH3kW2cJ+QqNrCgou3sOQw5npMFbE0mbvDCb1roS6Fc3DlDsp0XHm7u
 B/lXYEMrdBVPFA49ZMLq5izfOnKsEdLXd2VACCGYFQaRY2qdchBW4D6H5CAU3MCdziAj
 S1hcuiFUfHCtRllTbVpowU/YS585LJvfYI+rb+vKtJhzG/cFMDZ/k8cStXroJ9Q4zgmP
 P3/C/9WX+HOkhv0qR1ViyKPwePUIHb0NGJ1zwHSRuMWN/VVsllvqNVEGX/dt0jBJKO/w
 SeKQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1764710019; x=1765314819;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=6bp70/zB7s9JIMppGbfFSoteuS66DBzS5DiehnwaNAM=;
 b=jmFuYhIyaxtCHxXxOyt2J+SQzqW3Le+ZmN3+SbnP+GbfGC1+O//qdvrVJMhjBm9Bpv
 DLJeShLbGdrg51SktOCP4MDlrtYwAvExEF2GLTKnpod0KTs0BYHqhdNc4yuCnTzTpaWg
 BXvkoT06DViLAyS6S8f1HfNJl2TpZuHyLKC0eAPAJco8ZjYEONwYbirQSH3ZotOTxBBF
 W32NmDHM892Pbsdbhmm/mVTZv65/lozKwbc9IABKlUVbx1wnzWbWhInzBTl2QJWtwTXz
 Dci8P2p8WebI4p0HZZBhGQMKfO0B3s9DEQnsz3bJWT4+q3twHJqr6C7Vd0O/AWJ3x2bd
 nblA==
X-Gm-Message-State: AOJu0YxWtATGk4v9/jVh0440a3YNSVKNBJOfzTSQwUxHBIWWrhMTXPW3
 Uq6V4p5QvvMCC2Tq30NoZJMUJhByZUp4yTrdIF6qr3fNVcPvMIBqfTiN/SRm/4NCPj/hqKitcD2
 zX/3fiadxVoQ6Nqvsm/5qZHiK6UhYU+kNsA==
X-Gm-Gg: ASbGnct+ROHphcpRa59eNXCz+4uP+LkCu7AfTabSQR4B2TieZAYo8txYgKXC5BmMoT/
 EtEnoITKzSRRKkX1lDO9N6BLRKC6tcokqz8LYh6m5cDE98o9tA76R5cZ2p4H8JlT1ys0aMesWag
 +Y3KIqBTwkg7brbvJ9NNIwjVmQ4KI+q4e40i67EIFErShJ3czHlKQ/6C6jLa9O7pElB+Z3Aolu+
 j03+5vFNtDnE/cuvlszumvbES3Tl60FvvSIr0WnUAI7PjCEEMpO/mChi+/VOyHRVIvLOR/BmTjw
 kJdTKA==
X-Google-Smtp-Source: AGHT+IE7oPJ58SMvDm5R57y7slp2cZ2+BnsG3YjL9RmQ4aNHzczJ4z7EKL/ut974+k1aJD6Rafh1ImAWNN1mS2buFqk=
X-Received: by 2002:a05:6512:32ca:b0:595:7df4:6930 with SMTP id
 2adb3069b0e04-597d24e0a19mr339402e87.8.1764710018482; Tue, 02 Dec 2025
 13:13:38 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Tue, 2 Dec 2025 13:13:38 -0800
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Tue, 2 Dec 2025 13:13:38 -0800
From: Kristoffer Balintona <krisbalintona@HIDDEN>
In-Reply-To: <86v7io3oir.fsf@HIDDEN>
References: <CANVbq5n2_P6yfN+SK7riDVN4eyfoBh-jaAjtAzJLGjNsf8SFUA@HIDDEN>
 <86v7io3oir.fsf@HIDDEN>
MIME-Version: 1.0
Date: Tue, 2 Dec 2025 13:13:38 -0800
X-Gm-Features: AWmQ_blJQYieX_9UmQd-1oll2dstW2q-oXGon_dAeTk7pPjfpaNHxghzhk-brEo
Message-ID: <CANVbq5knaU-wM8bsiNhY7-iWYY69wQbUxB4TkLw_YSCXt9i_Vw@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Tue, Dec 02 2025, Eli Zaretskii wrote:

>> From: Kristoffer Balintona <krisbalintona@HIDDEN>
>> Date: Mon, 1 Dec 2025 21:10:00 -0500
>>
>> I've attached that improves the performance of
>> `flyspell-goto-next-error' significantly by having it use
>> `previous-overlay-change' and `next-overlay-change' instead of calling
>> `flyspell-overlay-p' on every character until it finds a misspelling.
>>
>> Here's a quick, naive benchmark on a semi-large file of mine with many
>> misspellings:
>>
>>     (benchmark-run 10
>>       (save-excursion
>>         (goto-char (point-min))
>>         (while (not (eobp))
>>           (flyspell-goto-next-error))))
>>     ;; Before: (13.282584424 0 0.0)
>>     ;; After: (0.319260975 0 0.0)
>
> Thanks, this is a good improvement.
>
> However, it doesn't only replace one-position-at-a-time test with
> next/previous-overlay-change, it also uses 'any' instead of the
> explicit loop in the original implementation.  And I wonder whether
> 'any', given its more general implementation, might be slower of that
> original loop?  Or maybe it's faster?  Did you test that aspect?

No, I hadn't tested whether `any' would be faster or not compared to
explicitly looping through every overlay at a given point. Although, if
it's any slower, I would expect the difference to be so minuscule that a
human wouldn't notice in practice (unless there were tons and tons of
overlays atop the same point?). I'm not an expert in elisp performance
though, so correct me if I'm wrong.

I mostly used 'any' since it could make the check a readable one-liner,
but if you want me to revert
    (not (any #'flyspell-overlay-p (overlays-at pos)))
or replace it with another way to check the overlays, then I can do
that.

-- 
Kind regards,
Kristoffer




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#79933: [PATCH] Improve performance of 'flyspell-goto-next-error'
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 03 Dec 2025 12:47:04 +0000
Resent-Message-ID: <handler.79933.B79933.17647660122803 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79933
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Kristoffer Balintona <krisbalintona@HIDDEN>
Cc: 79933 <at> debbugs.gnu.org
Received: via spool by 79933-submit <at> debbugs.gnu.org id=B79933.17647660122803
          (code B ref 79933); Wed, 03 Dec 2025 12:47:04 +0000
Received: (at 79933) by debbugs.gnu.org; 3 Dec 2025 12:46:52 +0000
Received: from localhost ([127.0.0.1]:40017 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vQmFu-0000ip-1Q
	for submit <at> debbugs.gnu.org; Wed, 03 Dec 2025 07:46:52 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48230)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vQmFr-0000hV-B5
 for 79933 <at> debbugs.gnu.org; Wed, 03 Dec 2025 07:46:48 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1vQmFk-0006TA-Is; Wed, 03 Dec 2025 07:46:41 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=3iIkitmyQJL/moAQbIBVr1RvksbTyefbsssQDh7a38c=; b=HFlX+pMqbJ0c
 OXegguW9J7kdRJVKYZT0LvQWnBCh129zbRxD7eMx0x2O/wMBeerD79ccT1EixdCMOVmp5woYKmp7v
 60Pd1KnW3vshxTeMZLDIbmgJz/ZdkNwMDdX8PqLAqzXQdlUDiSPyLTw96oGZRnDcPFhBJikSYMqUo
 zHyTMKW/D+b+0+BLoURvOd1/PqF6l5JyDvTgkXA2oHDN5QSPL+CqEeYoSg1HGG6KL0FvbVlBrRxTs
 lG9m2ZRWuDi+6/nwuGRykw/UbVRVd/dcWlqSbKUOHVVV6iOOYhfDz6eot14P7PiFXGOM1U34svJs5
 chRItRib0QCYZUGuliXKIQ==;
Date: Wed, 03 Dec 2025 14:46:37 +0200
Message-Id: <864iq73f82.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <CANVbq5knaU-wM8bsiNhY7-iWYY69wQbUxB4TkLw_YSCXt9i_Vw@HIDDEN>
 (message from Kristoffer Balintona on Tue, 2 Dec 2025 13:13:38 -0800)
References: <CANVbq5n2_P6yfN+SK7riDVN4eyfoBh-jaAjtAzJLGjNsf8SFUA@HIDDEN>
 <86v7io3oir.fsf@HIDDEN>
 <CANVbq5knaU-wM8bsiNhY7-iWYY69wQbUxB4TkLw_YSCXt9i_Vw@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Kristoffer Balintona <krisbalintona@HIDDEN>
> Date: Tue, 2 Dec 2025 13:13:38 -0800
> Cc: 79933 <at> debbugs.gnu.org
> 
> On Tue, Dec 02 2025, Eli Zaretskii wrote:
> 
> > However, it doesn't only replace one-position-at-a-time test with
> > next/previous-overlay-change, it also uses 'any' instead of the
> > explicit loop in the original implementation.  And I wonder whether
> > 'any', given its more general implementation, might be slower of that
> > original loop?  Or maybe it's faster?  Did you test that aspect?
> 
> No, I hadn't tested whether `any' would be faster or not compared to
> explicitly looping through every overlay at a given point. Although, if
> it's any slower, I would expect the difference to be so minuscule that a
> human wouldn't notice in practice (unless there were tons and tons of
> overlays atop the same point?). I'm not an expert in elisp performance
> though, so correct me if I'm wrong.

I don't know if you are wrong; you may be right.  What I wanted to
suggest is to try and time that other possibility, then decide.  If
you can afford that, of course.

> I mostly used 'any' since it could make the check a readable one-liner,
> but if you want me to revert
>     (not (any #'flyspell-overlay-p (overlays-at pos)))
> or replace it with another way to check the overlays, then I can do
> that.

Yes, the simplicity of the code is evident.  The question is how much,
if anything, do we pay for that.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#79933: [PATCH] Improve performance of 'flyspell-goto-next-error'
Resent-From: Kristoffer Balintona <krisbalintona@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 03 Dec 2025 22:17:02 +0000
Resent-Message-ID: <handler.79933.B79933.176480017929151 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79933
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 79933 <at> debbugs.gnu.org
Received: via spool by 79933-submit <at> debbugs.gnu.org id=B79933.176480017929151
          (code B ref 79933); Wed, 03 Dec 2025 22:17:02 +0000
Received: (at 79933) by debbugs.gnu.org; 3 Dec 2025 22:16:19 +0000
Received: from localhost ([127.0.0.1]:44139 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vQv91-0007a2-31
	for submit <at> debbugs.gnu.org; Wed, 03 Dec 2025 17:16:19 -0500
Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]:58855)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <krisbalintona@HIDDEN>)
 id 1vQv8y-0007Z5-U3
 for 79933 <at> debbugs.gnu.org; Wed, 03 Dec 2025 17:16:17 -0500
Received: by mail-lf1-x136.google.com with SMTP id
 2adb3069b0e04-5959da48139so255856e87.1
 for <79933 <at> debbugs.gnu.org>; Wed, 03 Dec 2025 14:16:16 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1764800170; x=1765404970; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=JbnoW0Mcs3XlDtgh+SSxPihtgqSiMcui7L8kWUKjl3g=;
 b=NGpTGBKlLaIC/cxBRdiIzR1nGFb+fjUipO/WpOIHBspUGDdxpAT4Ja2eAbao5+kVaB
 K6CltH2nlhIOfYPy7h5d2b3rMdHVwh0KTIHwRGhMGmuFuF80Le58DyJfuM29fY6DmFpA
 UPMLn1cLKo+dd4xdAEPoevDZEQDuyr8zynSBj6D8phairSlxgTx4IXKfanF9fwKkvS+o
 Rektk6L6RMrlhPbqhgeHvrzMJd7rXOsQi0GMxFfavTb8avkzXo3asItW+KHtT/GH/Eks
 PF6kDrzrrmnNDthc7uLjxU3VK12PVK1h7MCE8Q8FcQUIYLMSyfNVjubsvnhLfw7x62k7
 m9kg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1764800170; x=1765404970;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=JbnoW0Mcs3XlDtgh+SSxPihtgqSiMcui7L8kWUKjl3g=;
 b=useEZ8UaP8+olGvLmvw3VHear9GOa1V1XV2xP03t8n5W7iye19X8KcKqPKNm4179ek
 +vH9THm3Us/DavhKkCO+8zRGPsp6B5yX5Cm38YkOO/QqR11U5jcrSyCu/gxkqYR8Regb
 vrzGE7bR+6upU4JIQovaP8MGhPXe1KMTw3KlkCbl7gULJ+ULeKkEWvcXxxZOXXl1veLP
 aKEuMN/chX+S7Sv02pzwMVQUrqPrCcbOPAmWWrCgO4WOWotciRBt/Bt9wSo4Ae6jzf5c
 qdWgjnInRkeSOXilW0sjdK3Q4CQ2DzzeV6vusNC/soOlCci92BuV+BYx5s8mXX89cpce
 m22A==
X-Gm-Message-State: AOJu0Yza2cv9OvrZS1d9j2p8oE5x5CaP+UsCB4FicNwcXNVgdMtyl5M5
 WJdvj5LmBlLlibY+ouNSP90zRsafmVH3NlESH9ndPmTrUrpUj2XOQ+ddPGjgtnETxfKOpmxylUa
 0pFcxV+vd65oHlk7q6G7Ay1shRKxdn48=
X-Gm-Gg: ASbGnctVIGP9OYrO+HAvUiR5Yk2HOEDWbeO1iulsh8377o9mmmGDG0j0Om6I/AHhHsH
 HK++aeXG6ISpcWnUD6/be1h3as95bLbFmn6AsnzDuYHPmTvOBuB9o1R8HiCosd6w1eRwWggaX7n
 OV/BCvvtnYXZSped4MuXIlQi297pkog66gaciMSkSXpIg9CfMycriVGwMMeoud2omBMjhvqzESj
 7A8JBzlI2Jz/BeUx/VwTIWAAmZe
X-Google-Smtp-Source: AGHT+IEMbFhsWEIALJFJm0gI0tEuvQTJ0u8Va1h/bBwqdk8SaCZeMUBTE1OoeHme0RdHgiX9f2RYRGtMMtLIhWUYm5k=
X-Received: by 2002:a05:6512:3e15:b0:595:90ef:4fa2 with SMTP id
 2adb3069b0e04-597d66ccd87mr166772e87.39.1764800170140; Wed, 03 Dec 2025
 14:16:10 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Wed, 3 Dec 2025 14:16:09 -0800
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Wed, 3 Dec 2025 14:16:09 -0800
From: Kristoffer Balintona <krisbalintona@HIDDEN>
In-Reply-To: <864iq73f82.fsf@HIDDEN>
References: <CANVbq5n2_P6yfN+SK7riDVN4eyfoBh-jaAjtAzJLGjNsf8SFUA@HIDDEN>
 <86v7io3oir.fsf@HIDDEN>
 <CANVbq5knaU-wM8bsiNhY7-iWYY69wQbUxB4TkLw_YSCXt9i_Vw@HIDDEN>
 <864iq73f82.fsf@HIDDEN>
MIME-Version: 1.0
Date: Wed, 3 Dec 2025 14:16:09 -0800
X-Gm-Features: AWmQ_bnT6CjsXol-1-LPNMHXJr2ZqAare4v49hK8VbcMMtjm3Dl0CwtqNTwSjwY
Message-ID: <CANVbq5nnUtwMjs-FMFBNoEG0bQ8wc5g1Shd8UQa4zN_EzWY4sA@HIDDEN>
Content-Type: multipart/mixed; boundary="0000000000003ddd780645138fde"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--0000000000003ddd780645138fde
Content-Type: text/plain; charset="UTF-8"

On Wed, Dec 03 2025, Eli Zaretskii wrote:

>> From: Kristoffer Balintona <krisbalintona@HIDDEN>
>> Date: Tue, 2 Dec 2025 13:13:38 -0800
>> Cc: 79933 <at> debbugs.gnu.org
>>
>> On Tue, Dec 02 2025, Eli Zaretskii wrote:
>>
>> > However, it doesn't only replace one-position-at-a-time test with
>> > next/previous-overlay-change, it also uses 'any' instead of the
>> > explicit loop in the original implementation.  And I wonder whether
>> > 'any', given its more general implementation, might be slower of that
>> > original loop?  Or maybe it's faster?  Did you test that aspect?
>>
>> No, I hadn't tested whether `any' would be faster or not compared to
>> explicitly looping through every overlay at a given point. Although, if
>> it's any slower, I would expect the difference to be so minuscule that a
>> human wouldn't notice in practice (unless there were tons and tons of
>> overlays atop the same point?). I'm not an expert in elisp performance
>> though, so correct me if I'm wrong.
>
> I don't know if you are wrong; you may be right.  What I wanted to
> suggest is to try and time that other possibility, then decide.  If
> you can afford that, of course.

Did a little more testing. Looks like using 'any' didn't decrease speed
compared to explicitly looping with 'while'.

--0000000000003ddd780645138fde
Content-Type: text/plain; charset="US-ASCII"
Content-Disposition: attachment
Content-Transfer-Encoding: base64
X-Attachment-Id: e9228255cc5b9f26_0.2

Ci0tIApLaW5kIHJlZ2FyZHMsCktyaXN0b2ZmZXIK
--0000000000003ddd780645138fde
Content-Type: application/emacs-lisp; name="benchmarks.el"
Content-Disposition: attachment; filename="benchmarks.el"
Content-Transfer-Encoding: base64
X-Attachment-Id: e9228255cc5b9f26_0.1

KHByb2duCiAgKGZseXNwZWxsLWJ1ZmZlcikKICAoYmVuY2htYXJrLXJ1bi1jb21waWxlZCAyMAog
ICAgKGxldCAoKGNvdW50IDApKQogICAgICAoc2F2ZS1leGN1cnNpb24KICAgICAgICAoZ290by1j
aGFyIChwb2ludC1taW4pKQogICAgICAgICh3aGlsZSAobm90IChlb2JwKSkKICAgICAgICAgIChm
bHlzcGVsbC1nb3RvLW5leHQtZXJyb3IpCiAgICAgICAgICAoY2wtaW5jZiBjb3VudCkpKQogICAg
ICAobWVzc2FnZSAibWlzc3BlbGxpbmcgY291bnQ6ICVzIiBjb3VudCkpKSkKOzsgTWlzc3BlbGxp
bmcgY291bnQ6IDQ0MzAKOzsgT3JpZ2luYWw6ICgzLjI2NDYwNzc5NyAwIDAuMCkKOzsgV2hpbGU6
ICgwLjI1NjQ1NTA4IDAgMC4wKQo7OyBBbnk6ICgwLjI1NzMzODk2OSAwIDAuMCkKCjs7IEFkZCAy
MCBvdmVybGF5cyBvdmVyIHRoZSBlbnRpcmUgYnVmZmVyLCBzbyBhdCBldmVyeSBwb2ludAo7OyBg
Zmx5c3BlbGwtZ290by1uZXh0LWVycm9yJyBjaGVja3MgZm9yIGEgbWlzc3BlbGxpbmcgaXQgaGFz
IHRvIGdvCjs7IGNoZWNrIG90aGVyIG92ZXJsYXlzCjs7IE5PVEU6IFRoZSB0ZXN0IGJlbG93IGlz
IGluIGEgYnVmZmVyIHdpdGggZmV3ZXIgbWlzc3BlbGxpbmdzIHRoYW4KOzsgdGhlIGFib3ZlIHRl
c3QKKHByb2duCiAgKGZseXNwZWxsLWJ1ZmZlcikKICAoZG90aW1lcyAoXyAyMCkKICAgIChtYWtl
LW92ZXJsYXkgKHBvaW50LW1pbikgKHBvaW50LW1heCkpKQogIChiZW5jaG1hcmstcnVuLWNvbXBp
bGVkIDEwCiAgICAobGV0ICgoY291bnQgMCkpCiAgICAgIChzYXZlLWV4Y3Vyc2lvbgogICAgICAg
IChnb3RvLWNoYXIgKHBvaW50LW1pbikpCiAgICAgICAgKHdoaWxlIChub3QgKGVvYnApKQogICAg
ICAgICAgKGZseXNwZWxsLWdvdG8tbmV4dC1lcnJvcikKICAgICAgICAgIChjbC1pbmNmIGNvdW50
KSkpCiAgICAgIChtZXNzYWdlICJtaXNzcGVsbGluZyBjb3VudDogJXMiIGNvdW50KSkpKQo7OyBN
aXNzcGVsbGluZyBjb3VudDogMjE0MQo7OyBPcmlnaW5hbDogKDkuNzc1ODk4NjI0IDAgMC4wKQo7
OyBXaGlsZTogKDAuMTI0NjUwNTIyIDAgMC4wKQo7OyBBbnk6ICgwLjEyMzI1NDE5MyAwIDAuMCkK
--0000000000003ddd780645138fde--




Message sent:


MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Eli Zaretskii <eliz@HIDDEN>
Subject: bug#79933: closed ([PATCH] Improve performance of 'flyspell-goto-next-error')
CC: tracker <at> debbugs.gnu.org
Message-ID: <handler.79933.D79933.176485088320005.ackdone <at> debbugs.gnu.org>
References: <867bv21lqf.fsf@HIDDEN>
 <CANVbq5n2_P6yfN+SK7riDVN4eyfoBh-jaAjtAzJLGjNsf8SFUA@HIDDEN>
X-Gnu-PR-Message: closed 79933
X-Gnu-PR-Package: emacs
X-Gnu-PR-Keywords: patch
Date: Thu, 04 Dec 2025 12:22:01 +0000
Content-Type: multipart/mixed; boundary="----------=_1764850921-20161-0"

This is a multi-part message in MIME format...

------------=_1764850921-20161-0
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=utf-8

Your message dated Thu, 04 Dec 2025 14:21:12 +0200
with message-id <867bv21lqf.fsf@HIDDEN>
and subject line Re: bug#79933: [PATCH] Improve performance of 'flyspell-go=
to-next-error'
has caused the debbugs.gnu.org bug report #79933,
regarding [PATCH] Improve performance of 'flyspell-goto-next-error'
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@HIDDEN)


--=20
79933: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D79933
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems

------------=_1764850921-20161-0
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Received: (at submit) by debbugs.gnu.org; 2 Dec 2025 02:10:19 +0000
Received: from localhost ([127.0.0.1]:54821 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vQFqM-00063H-RF
	for submit <at> debbugs.gnu.org; Mon, 01 Dec 2025 21:10:19 -0500
Received: from lists.gnu.org ([2001:470:142::17]:52202)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <krisbalintona@HIDDEN>)
 id 1vQFqK-00060Q-77
 for submit <at> debbugs.gnu.org; Mon, 01 Dec 2025 21:10:16 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <krisbalintona@HIDDEN>)
 id 1vQFqC-0003ge-Jy
 for bug-gnu-emacs@HIDDEN; Mon, 01 Dec 2025 21:10:08 -0500
Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <krisbalintona@HIDDEN>)
 id 1vQFqA-0001QO-MF
 for bug-gnu-emacs@HIDDEN; Mon, 01 Dec 2025 21:10:08 -0500
Received: by mail-ed1-x529.google.com with SMTP id
 4fb4d7f45d1cf-640aaa89697so7123900a12.3
 for <bug-gnu-emacs@HIDDEN>; Mon, 01 Dec 2025 18:10:04 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1764641402; x=1765246202; darn=gnu.org;
 h=to:subject:message-id:date:mime-version:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=Xw+nG+Osu2a0T1sAu+XOtJlmKklzWYjnZM0bFW00kWM=;
 b=X6If9Q2QdOuIFphm6Kkpz7EEFqzNpwVBaoTKYIwENR3VQAbEYSnvmDyzY/Th5QyKC8
 roMJunXdZAY9x6vWgBQj/zByrSwLVUKrGyhcRjMYBDS4D5y2eIob6NkgYPosCbQBa1Ny
 WOXZCRkRzPudBSRXWCQO0ctPAOmhIB0Yh6qx7q9WJMqIDogoHv+XYeofFUe5vy17cjqD
 DPK6d1M1DtuxuwoFW2JO/jYZjizCnE99lZiTi5K6u67d+NW9rDvILowxVNqvSYds/bWG
 EEa9iNIHDeByCyQog/dXwaVP5SLEh76I4p1sUU/7fs76lMGNRvIC5v4XF3Nto5nr8Lrv
 egQQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1764641402; x=1765246202;
 h=to:subject:message-id:date:mime-version:from:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=Xw+nG+Osu2a0T1sAu+XOtJlmKklzWYjnZM0bFW00kWM=;
 b=RoJ2/3Ka1EofGtLFbjwiUFWzRprZ9dlOrVzE3dWKa/rnxnF6t0FbKu6KxRVxbiUMOc
 MA4r7NY88QMrldbtIPmFr25kbJmph3hJcOMfZdH9LriLSQNbQYp/weP7ytAcjMesNvuQ
 tj+ds9VeXtXw1UKDx3ibY/9tcqyLm6jn0ieRGiXlCn9I5hV/0G+JHF6enscDQtiynTPd
 yRhXyBGoDLA1EavJ6/ZzXIJs8qxmoxCuOnemvScAnPFRKqAutbSOO1w0cCp3reou0BZ6
 mlMWJG+E/iJd8JKas384oVQMt5DiUQfk+IYZzTXLbwNqH4xXfyRJI7/hZZdmX+xq/Tcz
 GoIg==
X-Gm-Message-State: AOJu0YyGcTJITYVjr2S1upvNXdD7GFPWgnHDarNZu6aabpaoqDvRMHdq
 a25cTrkrw0lxzVOkW1F6Nnl9S8HfpG5k6l9adNurk607QCJQU1O8LI0sV37ncKd4HYRVlOuH7dy
 HIU/mp2GELqlRd9xgvWbFKqsAjogO4883xaOP
X-Gm-Gg: ASbGncuKfOa+wH363xI5i2EdCMCKiE4EX2+xdNHJjHoJy2e1MMX1jRxIDeSczwtctX1
 LRaXPbrWNXH6wBDkHGdl+gI3iVvmFIJ9gCQC38BZJAqQ5sfZ257BUlFziXZ7L+IxrFI4lXp6cYK
 7h/d1dc0PHCx7SnMYN7bNaqMECIOwJn5vEQiVowUTU6gMswaMxTRBMm+0shoDYjSZKnambUoQkh
 jyql9ZKx01zdAUkRnZMsSO86ohVopSNovqwyZ0I6zgmEZ8ImSBowex2dodVxS2IC98XdmM=
X-Google-Smtp-Source: AGHT+IHzmkjIOiTPS7Ek3Xwt01Sl+XefwOrCrlcJAHCMiBzFgUxJ3PaqS4nHAgo2+j5A/B/Mf9QvTXX6xe4ZvduqhLI=
X-Received: by 2002:a05:6402:40cc:b0:640:b978:efdb with SMTP id
 4fb4d7f45d1cf-6455469c11dmr34722414a12.25.1764641402422; Mon, 01 Dec 2025
 18:10:02 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Mon, 1 Dec 2025 21:10:00 -0500
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Mon, 1 Dec 2025 21:10:00 -0500
From: Kristoffer Balintona <krisbalintona@HIDDEN>
MIME-Version: 1.0
Date: Mon, 1 Dec 2025 21:10:00 -0500
X-Gm-Features: AWmQ_bmirUOy4HVuoCTUA5BbPuBVpzzmCgPvzJ2uscW6g3YPpQTWZm26Zxsd9m8
Message-ID: <CANVbq5n2_P6yfN+SK7riDVN4eyfoBh-jaAjtAzJLGjNsf8SFUA@HIDDEN>
Subject: [PATCH] Improve performance of 'flyspell-goto-next-error'
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/mixed; boundary="000000000000f2bb600644ee97fb"
Received-SPF: pass client-ip=2a00:1450:4864:20::529;
 envelope-from=krisbalintona@HIDDEN; helo=mail-ed1-x529.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--000000000000f2bb600644ee97fb
Content-Type: text/plain; charset="UTF-8"

Tags: patch

Hello,

I've attached that improves the performance of
`flyspell-goto-next-error' significantly by having it use
`previous-overlay-change' and `next-overlay-change' instead of calling
`flyspell-overlay-p' on every character until it finds a misspelling.

Here's a quick, naive benchmark on a semi-large file of mine with many
misspellings:

    (benchmark-run 10
      (save-excursion
        (goto-char (point-min))
        (while (not (eobp))
          (flyspell-goto-next-error))))
    ;; Before: (13.282584424 0 0.0)
    ;; After: (0.319260975 0 0.0)

This probably won't be too noticeable to a human when a user calls the
command once, but on repeat calls on a large buffer it might be.

For future reference, are mini-refactoring patches without performance
gains welcome? I have been trying to see if I can improve flyspell
performance and would like to know what is acceptable as a patch.


In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.49, cairo version 1.18.4)
Windowing system distributor 'Microsoft Corporation', version 11.0.12010000
System Description: Arch Linux

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/9pi8kah55s964qfik4cqysjdq74ll4sv-bash-minimal-5.2.37/bin/bash
 SHELL=/gnu/store/9pi8kah55s964qfik4cqysjdq74ll4sv-bash-minimal-5.2.37/bin/bash
 --prefix=/gnu/store/6w3c8fi1yvjahq0biv8bxjf0kgjzaici-emacs-master-31.0.50-1.11b68c6
 --enable-fast-install
 --docdir=/gnu/store/qk5y2mpib8qykghqff30lndjn6v5vvng-emacs-master-31.0.50-1.11b68c6-doc/share/doc/emacs-master-31.0.50
 --with-cairo --with-modules --with-native-compilation=aot 'CFLAGS=-g
 -O2 -Wno-error=incompatible-pointer-types' --disable-build-details'

--000000000000f2bb600644ee97fb
Content-Type: text/plain; charset="US-ASCII"
Content-Disposition: attachment
Content-Transfer-Encoding: base64
X-Attachment-Id: 4082f00b1f823c4b_0.2

Ci0tIApLaW5kIHJlZ2FyZHMsCktyaXN0b2ZmZXIK
--000000000000f2bb600644ee97fb
Content-Type: text/x-patch; charset="US-ASCII"; 
	name="0001-Improve-performance-of-flyspell-goto-next-error.patch"
Content-Disposition: attachment; 
	filename="0001-Improve-performance-of-flyspell-goto-next-error.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: 4082f00b1f823c4b_0.1

RnJvbSAzNGZmOTkzOWZiNjc3OWU4NTI2OTM5Mzk3MmY5Njg5ODIxYzVhZGI1IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBLcmlzdG9mZmVyIEJhbGludG9uYSA8a3Jpc2JhbGludG9uYUBn
bWFpbC5jb20+CkRhdGU6IFdlZCwgMjYgTm92IDIwMjUgMDg6MDQ6MjIgLTA2MDAKU3ViamVjdDog
W1BBVENIIDEvMV0gSW1wcm92ZSBwZXJmb3JtYW5jZSBvZiAnZmx5c3BlbGwtZ290by1uZXh0LWVy
cm9yJwoKKiBsaXNwL3RleHRtb2Rlcy9mbHlzcGVsbC5lbCAoZmx5c3BlbGwtZ290by1uZXh0LWVy
cm9yKTogVXNlCiduZXh0LW92ZXJsYXktY2hhbmdlJyBhbmQgJ3ByZXZpb3VzLW92ZXJsYXktY2hh
bmdlJy4KLS0tCiBsaXNwL3RleHRtb2Rlcy9mbHlzcGVsbC5lbCB8IDE0ICsrKystLS0tLS0tLS0t
CiAxIGZpbGUgY2hhbmdlZCwgNCBpbnNlcnRpb25zKCspLCAxMCBkZWxldGlvbnMoLSkKCmRpZmYg
LS1naXQgYS9saXNwL3RleHRtb2Rlcy9mbHlzcGVsbC5lbCBiL2xpc3AvdGV4dG1vZGVzL2ZseXNw
ZWxsLmVsCmluZGV4IGQ2MmMzZmQxMzVkLi5hYzgwNjFlNjVkZCAxMDA2NDQKLS0tIGEvbGlzcC90
ZXh0bW9kZXMvZmx5c3BlbGwuZWwKKysrIGIvbGlzcC90ZXh0bW9kZXMvZmx5c3BlbGwuZWwKQEAg
LTE3NDgsMTcgKzE3NDgsMTEgQEAgRkxZU1BFTEwtQlVGRkVSLiIKICAgICAgIChzZXRxIHBvcyAo
cG9pbnQpKSkKICAgICA7OyBTZWVrIHRoZSBuZXh0IGVycm9yLgogICAgICh3aGlsZSAoYW5kICgv
PSBwb3MgbWF4KQotCQkobGV0ICgob3ZzIChvdmVybGF5cy1hdCBwb3MpKQotCQkgICAgICAociAn
KCkpKQotCQkgICh3aGlsZSAoYW5kIChub3QgcikgKGNvbnNwIG92cykpCi0JCSAgICAoaWYgKGZs
eXNwZWxsLW92ZXJsYXktcCAoY2FyIG92cykpCi0JCQkoc2V0cSByIHQpCi0JCSAgICAgIChzZXRx
IG92cyAoY2RyIG92cykpKSkKLQkJICAobm90IHIpKSkKLSAgICAgIChzZXRxIHBvcyAoaWYgcHJl
dmlvdXMgKDEtIHBvcykgKDErIHBvcykpKSkKKyAgICAgICAgICAgICAgICAoc2V0cSBwb3MgKGlm
IHByZXZpb3VzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocHJldmlvdXMtb3Zlcmxh
eS1jaGFuZ2UgcG9zKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIChuZXh0LW92ZXJsYXkt
Y2hhbmdlIHBvcykpKQorICAgICAgICAgICAgICAgIChub3QgKGFueSAjJ2ZseXNwZWxsLW92ZXJs
YXktcCAob3ZlcmxheXMtYXQgcG9zKSkpKSkKICAgICAoZ290by1jaGFyIHBvcykKLSAgICAod2hl
biBwcmV2aW91cwotICAgICAgKGZvcndhcmQtd29yZCAtMSkpCiAgICAgOzsgU2F2ZSB0aGUgY3Vy
cmVudCBsb2NhdGlvbiBmb3IgbmV4dCBpbnZvY2F0aW9uLgogICAgIChzZXRxIGZseXNwZWxsLW9s
ZC1wb3MtZXJyb3IgKHBvaW50KSkKICAgICAoc2V0cSBmbHlzcGVsbC1vbGQtYnVmZmVyLWVycm9y
IChjdXJyZW50LWJ1ZmZlcikpCi0tIAoyLjUyLjAKCg==
--000000000000f2bb600644ee97fb--



------------=_1764850921-20161-0
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Received: (at 79933-done) by debbugs.gnu.org; 4 Dec 2025 12:21:23 +0000
Received: from localhost ([127.0.0.1]:48170 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vR8Kp-0005Ca-67
	for submit <at> debbugs.gnu.org; Thu, 04 Dec 2025 07:21:23 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:57888)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vR8Km-0005CF-I6
 for 79933-done <at> debbugs.gnu.org; Thu, 04 Dec 2025 07:21:20 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1vR8Kh-0000QD-94; Thu, 04 Dec 2025 07:21:15 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=yviEsdgG0T1F1j/NHw5i10aL66titGZpoSpfzETPhVo=; b=l0mHcsnNaip0
 1SOhrDHWq8feolxvgfLvXXA/fvv30/Ga2eOlN8KG5qfsv++W5PIKs2WqNNYJX3OCaL2ikLWJK/249
 WLM66hb5P7lOyl9fQkRcQRBGkSbk9XlJhatxJyUaZaHkzalM3xlcQj6ns9F+bD8ECMR/AFIrsxq9K
 YYoD7tDFQLxCkO43+qefYXVJv6LMYBc3NpFOwNa/zx4VTDv1/AGa78x6AG9dbDzFdHZdcUJ5o7ze2
 61z1fzZmvFwdSzzcTK59J036V9KC4ChSw+Y1fSkSStX1Xvif7JXGjXm4vACS6FyZzbnE+ogWHry+X
 n/2xVF+EbE0AlbB8Msp2uQ==;
Date: Thu, 04 Dec 2025 14:21:12 +0200
Message-Id: <867bv21lqf.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Kristoffer Balintona <krisbalintona@HIDDEN>
In-Reply-To: <CANVbq5nnUtwMjs-FMFBNoEG0bQ8wc5g1Shd8UQa4zN_EzWY4sA@HIDDEN>
 (message from Kristoffer Balintona on Wed, 3 Dec 2025 14:16:09 -0800)
Subject: Re: bug#79933: [PATCH] Improve performance of
 'flyspell-goto-next-error'
References: <CANVbq5n2_P6yfN+SK7riDVN4eyfoBh-jaAjtAzJLGjNsf8SFUA@HIDDEN>
 <86v7io3oir.fsf@HIDDEN>
 <CANVbq5knaU-wM8bsiNhY7-iWYY69wQbUxB4TkLw_YSCXt9i_Vw@HIDDEN>
 <864iq73f82.fsf@HIDDEN>
 <CANVbq5nnUtwMjs-FMFBNoEG0bQ8wc5g1Shd8UQa4zN_EzWY4sA@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79933-done
Cc: 79933-done <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Kristoffer Balintona <krisbalintona@HIDDEN>
> Date: Wed, 3 Dec 2025 14:16:09 -0800
> Cc: 79933 <at> debbugs.gnu.org
> 
> On Wed, Dec 03 2025, Eli Zaretskii wrote:
> 
> >> From: Kristoffer Balintona <krisbalintona@HIDDEN>
> >> Date: Tue, 2 Dec 2025 13:13:38 -0800
> >> Cc: 79933 <at> debbugs.gnu.org
> >>
> >> On Tue, Dec 02 2025, Eli Zaretskii wrote:
> >>
> >> > However, it doesn't only replace one-position-at-a-time test with
> >> > next/previous-overlay-change, it also uses 'any' instead of the
> >> > explicit loop in the original implementation.  And I wonder whether
> >> > 'any', given its more general implementation, might be slower of that
> >> > original loop?  Or maybe it's faster?  Did you test that aspect?
> >>
> >> No, I hadn't tested whether `any' would be faster or not compared to
> >> explicitly looping through every overlay at a given point. Although, if
> >> it's any slower, I would expect the difference to be so minuscule that a
> >> human wouldn't notice in practice (unless there were tons and tons of
> >> overlays atop the same point?). I'm not an expert in elisp performance
> >> though, so correct me if I'm wrong.
> >
> > I don't know if you are wrong; you may be right.  What I wanted to
> > suggest is to try and time that other possibility, then decide.  If
> > you can afford that, of course.
> 
> Did a little more testing. Looks like using 'any' didn't decrease speed
> compared to explicitly looping with 'while'.

Thanks, so I've now installed your patch on the master branch, and I'm
closing this bug.


------------=_1764850921-20161-0--


Message sent:


MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Kristoffer Balintona <krisbalintona@HIDDEN>
Subject: bug#79933: closed (Re: bug#79933: [PATCH] Improve performance of
 'flyspell-goto-next-error')
Message-ID: <handler.79933.D79933.176485088320005.notifdone <at> debbugs.gnu.org>
References: <867bv21lqf.fsf@HIDDEN>
 <CANVbq5n2_P6yfN+SK7riDVN4eyfoBh-jaAjtAzJLGjNsf8SFUA@HIDDEN>
X-Gnu-PR-Message: they-closed 79933
X-Gnu-PR-Package: emacs
X-Gnu-PR-Keywords: patch
Reply-To: 79933 <at> debbugs.gnu.org
Date: Thu, 04 Dec 2025 12:22:02 +0000
Content-Type: multipart/mixed; boundary="----------=_1764850922-20161-1"

This is a multi-part message in MIME format...

------------=_1764850922-20161-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"

Your bug report

#79933: [PATCH] Improve performance of 'flyspell-goto-next-error'

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 79933 <at> debbugs.gnu.org.

--=20
79933: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D79933
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems

------------=_1764850922-20161-1
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Received: (at 79933-done) by debbugs.gnu.org; 4 Dec 2025 12:21:23 +0000
Received: from localhost ([127.0.0.1]:48170 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vR8Kp-0005Ca-67
	for submit <at> debbugs.gnu.org; Thu, 04 Dec 2025 07:21:23 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:57888)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vR8Km-0005CF-I6
 for 79933-done <at> debbugs.gnu.org; Thu, 04 Dec 2025 07:21:20 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1vR8Kh-0000QD-94; Thu, 04 Dec 2025 07:21:15 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=yviEsdgG0T1F1j/NHw5i10aL66titGZpoSpfzETPhVo=; b=l0mHcsnNaip0
 1SOhrDHWq8feolxvgfLvXXA/fvv30/Ga2eOlN8KG5qfsv++W5PIKs2WqNNYJX3OCaL2ikLWJK/249
 WLM66hb5P7lOyl9fQkRcQRBGkSbk9XlJhatxJyUaZaHkzalM3xlcQj6ns9F+bD8ECMR/AFIrsxq9K
 YYoD7tDFQLxCkO43+qefYXVJv6LMYBc3NpFOwNa/zx4VTDv1/AGa78x6AG9dbDzFdHZdcUJ5o7ze2
 61z1fzZmvFwdSzzcTK59J036V9KC4ChSw+Y1fSkSStX1Xvif7JXGjXm4vACS6FyZzbnE+ogWHry+X
 n/2xVF+EbE0AlbB8Msp2uQ==;
Date: Thu, 04 Dec 2025 14:21:12 +0200
Message-Id: <867bv21lqf.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Kristoffer Balintona <krisbalintona@HIDDEN>
In-Reply-To: <CANVbq5nnUtwMjs-FMFBNoEG0bQ8wc5g1Shd8UQa4zN_EzWY4sA@HIDDEN>
 (message from Kristoffer Balintona on Wed, 3 Dec 2025 14:16:09 -0800)
Subject: Re: bug#79933: [PATCH] Improve performance of
 'flyspell-goto-next-error'
References: <CANVbq5n2_P6yfN+SK7riDVN4eyfoBh-jaAjtAzJLGjNsf8SFUA@HIDDEN>
 <86v7io3oir.fsf@HIDDEN>
 <CANVbq5knaU-wM8bsiNhY7-iWYY69wQbUxB4TkLw_YSCXt9i_Vw@HIDDEN>
 <864iq73f82.fsf@HIDDEN>
 <CANVbq5nnUtwMjs-FMFBNoEG0bQ8wc5g1Shd8UQa4zN_EzWY4sA@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79933-done
Cc: 79933-done <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Kristoffer Balintona <krisbalintona@HIDDEN>
> Date: Wed, 3 Dec 2025 14:16:09 -0800
> Cc: 79933 <at> debbugs.gnu.org
> 
> On Wed, Dec 03 2025, Eli Zaretskii wrote:
> 
> >> From: Kristoffer Balintona <krisbalintona@HIDDEN>
> >> Date: Tue, 2 Dec 2025 13:13:38 -0800
> >> Cc: 79933 <at> debbugs.gnu.org
> >>
> >> On Tue, Dec 02 2025, Eli Zaretskii wrote:
> >>
> >> > However, it doesn't only replace one-position-at-a-time test with
> >> > next/previous-overlay-change, it also uses 'any' instead of the
> >> > explicit loop in the original implementation.  And I wonder whether
> >> > 'any', given its more general implementation, might be slower of that
> >> > original loop?  Or maybe it's faster?  Did you test that aspect?
> >>
> >> No, I hadn't tested whether `any' would be faster or not compared to
> >> explicitly looping through every overlay at a given point. Although, if
> >> it's any slower, I would expect the difference to be so minuscule that a
> >> human wouldn't notice in practice (unless there were tons and tons of
> >> overlays atop the same point?). I'm not an expert in elisp performance
> >> though, so correct me if I'm wrong.
> >
> > I don't know if you are wrong; you may be right.  What I wanted to
> > suggest is to try and time that other possibility, then decide.  If
> > you can afford that, of course.
> 
> Did a little more testing. Looks like using 'any' didn't decrease speed
> compared to explicitly looping with 'while'.

Thanks, so I've now installed your patch on the master branch, and I'm
closing this bug.


------------=_1764850922-20161-1
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Received: (at submit) by debbugs.gnu.org; 2 Dec 2025 02:10:19 +0000
Received: from localhost ([127.0.0.1]:54821 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vQFqM-00063H-RF
	for submit <at> debbugs.gnu.org; Mon, 01 Dec 2025 21:10:19 -0500
Received: from lists.gnu.org ([2001:470:142::17]:52202)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <krisbalintona@HIDDEN>)
 id 1vQFqK-00060Q-77
 for submit <at> debbugs.gnu.org; Mon, 01 Dec 2025 21:10:16 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <krisbalintona@HIDDEN>)
 id 1vQFqC-0003ge-Jy
 for bug-gnu-emacs@HIDDEN; Mon, 01 Dec 2025 21:10:08 -0500
Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <krisbalintona@HIDDEN>)
 id 1vQFqA-0001QO-MF
 for bug-gnu-emacs@HIDDEN; Mon, 01 Dec 2025 21:10:08 -0500
Received: by mail-ed1-x529.google.com with SMTP id
 4fb4d7f45d1cf-640aaa89697so7123900a12.3
 for <bug-gnu-emacs@HIDDEN>; Mon, 01 Dec 2025 18:10:04 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1764641402; x=1765246202; darn=gnu.org;
 h=to:subject:message-id:date:mime-version:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=Xw+nG+Osu2a0T1sAu+XOtJlmKklzWYjnZM0bFW00kWM=;
 b=X6If9Q2QdOuIFphm6Kkpz7EEFqzNpwVBaoTKYIwENR3VQAbEYSnvmDyzY/Th5QyKC8
 roMJunXdZAY9x6vWgBQj/zByrSwLVUKrGyhcRjMYBDS4D5y2eIob6NkgYPosCbQBa1Ny
 WOXZCRkRzPudBSRXWCQO0ctPAOmhIB0Yh6qx7q9WJMqIDogoHv+XYeofFUe5vy17cjqD
 DPK6d1M1DtuxuwoFW2JO/jYZjizCnE99lZiTi5K6u67d+NW9rDvILowxVNqvSYds/bWG
 EEa9iNIHDeByCyQog/dXwaVP5SLEh76I4p1sUU/7fs76lMGNRvIC5v4XF3Nto5nr8Lrv
 egQQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1764641402; x=1765246202;
 h=to:subject:message-id:date:mime-version:from:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=Xw+nG+Osu2a0T1sAu+XOtJlmKklzWYjnZM0bFW00kWM=;
 b=RoJ2/3Ka1EofGtLFbjwiUFWzRprZ9dlOrVzE3dWKa/rnxnF6t0FbKu6KxRVxbiUMOc
 MA4r7NY88QMrldbtIPmFr25kbJmph3hJcOMfZdH9LriLSQNbQYp/weP7ytAcjMesNvuQ
 tj+ds9VeXtXw1UKDx3ibY/9tcqyLm6jn0ieRGiXlCn9I5hV/0G+JHF6enscDQtiynTPd
 yRhXyBGoDLA1EavJ6/ZzXIJs8qxmoxCuOnemvScAnPFRKqAutbSOO1w0cCp3reou0BZ6
 mlMWJG+E/iJd8JKas384oVQMt5DiUQfk+IYZzTXLbwNqH4xXfyRJI7/hZZdmX+xq/Tcz
 GoIg==
X-Gm-Message-State: AOJu0YyGcTJITYVjr2S1upvNXdD7GFPWgnHDarNZu6aabpaoqDvRMHdq
 a25cTrkrw0lxzVOkW1F6Nnl9S8HfpG5k6l9adNurk607QCJQU1O8LI0sV37ncKd4HYRVlOuH7dy
 HIU/mp2GELqlRd9xgvWbFKqsAjogO4883xaOP
X-Gm-Gg: ASbGncuKfOa+wH363xI5i2EdCMCKiE4EX2+xdNHJjHoJy2e1MMX1jRxIDeSczwtctX1
 LRaXPbrWNXH6wBDkHGdl+gI3iVvmFIJ9gCQC38BZJAqQ5sfZ257BUlFziXZ7L+IxrFI4lXp6cYK
 7h/d1dc0PHCx7SnMYN7bNaqMECIOwJn5vEQiVowUTU6gMswaMxTRBMm+0shoDYjSZKnambUoQkh
 jyql9ZKx01zdAUkRnZMsSO86ohVopSNovqwyZ0I6zgmEZ8ImSBowex2dodVxS2IC98XdmM=
X-Google-Smtp-Source: AGHT+IHzmkjIOiTPS7Ek3Xwt01Sl+XefwOrCrlcJAHCMiBzFgUxJ3PaqS4nHAgo2+j5A/B/Mf9QvTXX6xe4ZvduqhLI=
X-Received: by 2002:a05:6402:40cc:b0:640:b978:efdb with SMTP id
 4fb4d7f45d1cf-6455469c11dmr34722414a12.25.1764641402422; Mon, 01 Dec 2025
 18:10:02 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Mon, 1 Dec 2025 21:10:00 -0500
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Mon, 1 Dec 2025 21:10:00 -0500
From: Kristoffer Balintona <krisbalintona@HIDDEN>
MIME-Version: 1.0
Date: Mon, 1 Dec 2025 21:10:00 -0500
X-Gm-Features: AWmQ_bmirUOy4HVuoCTUA5BbPuBVpzzmCgPvzJ2uscW6g3YPpQTWZm26Zxsd9m8
Message-ID: <CANVbq5n2_P6yfN+SK7riDVN4eyfoBh-jaAjtAzJLGjNsf8SFUA@HIDDEN>
Subject: [PATCH] Improve performance of 'flyspell-goto-next-error'
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/mixed; boundary="000000000000f2bb600644ee97fb"
Received-SPF: pass client-ip=2a00:1450:4864:20::529;
 envelope-from=krisbalintona@HIDDEN; helo=mail-ed1-x529.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--000000000000f2bb600644ee97fb
Content-Type: text/plain; charset="UTF-8"

Tags: patch

Hello,

I've attached that improves the performance of
`flyspell-goto-next-error' significantly by having it use
`previous-overlay-change' and `next-overlay-change' instead of calling
`flyspell-overlay-p' on every character until it finds a misspelling.

Here's a quick, naive benchmark on a semi-large file of mine with many
misspellings:

    (benchmark-run 10
      (save-excursion
        (goto-char (point-min))
        (while (not (eobp))
          (flyspell-goto-next-error))))
    ;; Before: (13.282584424 0 0.0)
    ;; After: (0.319260975 0 0.0)

This probably won't be too noticeable to a human when a user calls the
command once, but on repeat calls on a large buffer it might be.

For future reference, are mini-refactoring patches without performance
gains welcome? I have been trying to see if I can improve flyspell
performance and would like to know what is acceptable as a patch.


In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.49, cairo version 1.18.4)
Windowing system distributor 'Microsoft Corporation', version 11.0.12010000
System Description: Arch Linux

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/9pi8kah55s964qfik4cqysjdq74ll4sv-bash-minimal-5.2.37/bin/bash
 SHELL=/gnu/store/9pi8kah55s964qfik4cqysjdq74ll4sv-bash-minimal-5.2.37/bin/bash
 --prefix=/gnu/store/6w3c8fi1yvjahq0biv8bxjf0kgjzaici-emacs-master-31.0.50-1.11b68c6
 --enable-fast-install
 --docdir=/gnu/store/qk5y2mpib8qykghqff30lndjn6v5vvng-emacs-master-31.0.50-1.11b68c6-doc/share/doc/emacs-master-31.0.50
 --with-cairo --with-modules --with-native-compilation=aot 'CFLAGS=-g
 -O2 -Wno-error=incompatible-pointer-types' --disable-build-details'

--000000000000f2bb600644ee97fb
Content-Type: text/plain; charset="US-ASCII"
Content-Disposition: attachment
Content-Transfer-Encoding: base64
X-Attachment-Id: 4082f00b1f823c4b_0.2

Ci0tIApLaW5kIHJlZ2FyZHMsCktyaXN0b2ZmZXIK
--000000000000f2bb600644ee97fb
Content-Type: text/x-patch; charset="US-ASCII"; 
	name="0001-Improve-performance-of-flyspell-goto-next-error.patch"
Content-Disposition: attachment; 
	filename="0001-Improve-performance-of-flyspell-goto-next-error.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: 4082f00b1f823c4b_0.1

RnJvbSAzNGZmOTkzOWZiNjc3OWU4NTI2OTM5Mzk3MmY5Njg5ODIxYzVhZGI1IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBLcmlzdG9mZmVyIEJhbGludG9uYSA8a3Jpc2JhbGludG9uYUBn
bWFpbC5jb20+CkRhdGU6IFdlZCwgMjYgTm92IDIwMjUgMDg6MDQ6MjIgLTA2MDAKU3ViamVjdDog
W1BBVENIIDEvMV0gSW1wcm92ZSBwZXJmb3JtYW5jZSBvZiAnZmx5c3BlbGwtZ290by1uZXh0LWVy
cm9yJwoKKiBsaXNwL3RleHRtb2Rlcy9mbHlzcGVsbC5lbCAoZmx5c3BlbGwtZ290by1uZXh0LWVy
cm9yKTogVXNlCiduZXh0LW92ZXJsYXktY2hhbmdlJyBhbmQgJ3ByZXZpb3VzLW92ZXJsYXktY2hh
bmdlJy4KLS0tCiBsaXNwL3RleHRtb2Rlcy9mbHlzcGVsbC5lbCB8IDE0ICsrKystLS0tLS0tLS0t
CiAxIGZpbGUgY2hhbmdlZCwgNCBpbnNlcnRpb25zKCspLCAxMCBkZWxldGlvbnMoLSkKCmRpZmYg
LS1naXQgYS9saXNwL3RleHRtb2Rlcy9mbHlzcGVsbC5lbCBiL2xpc3AvdGV4dG1vZGVzL2ZseXNw
ZWxsLmVsCmluZGV4IGQ2MmMzZmQxMzVkLi5hYzgwNjFlNjVkZCAxMDA2NDQKLS0tIGEvbGlzcC90
ZXh0bW9kZXMvZmx5c3BlbGwuZWwKKysrIGIvbGlzcC90ZXh0bW9kZXMvZmx5c3BlbGwuZWwKQEAg
LTE3NDgsMTcgKzE3NDgsMTEgQEAgRkxZU1BFTEwtQlVGRkVSLiIKICAgICAgIChzZXRxIHBvcyAo
cG9pbnQpKSkKICAgICA7OyBTZWVrIHRoZSBuZXh0IGVycm9yLgogICAgICh3aGlsZSAoYW5kICgv
PSBwb3MgbWF4KQotCQkobGV0ICgob3ZzIChvdmVybGF5cy1hdCBwb3MpKQotCQkgICAgICAociAn
KCkpKQotCQkgICh3aGlsZSAoYW5kIChub3QgcikgKGNvbnNwIG92cykpCi0JCSAgICAoaWYgKGZs
eXNwZWxsLW92ZXJsYXktcCAoY2FyIG92cykpCi0JCQkoc2V0cSByIHQpCi0JCSAgICAgIChzZXRx
IG92cyAoY2RyIG92cykpKSkKLQkJICAobm90IHIpKSkKLSAgICAgIChzZXRxIHBvcyAoaWYgcHJl
dmlvdXMgKDEtIHBvcykgKDErIHBvcykpKSkKKyAgICAgICAgICAgICAgICAoc2V0cSBwb3MgKGlm
IHByZXZpb3VzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocHJldmlvdXMtb3Zlcmxh
eS1jaGFuZ2UgcG9zKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIChuZXh0LW92ZXJsYXkt
Y2hhbmdlIHBvcykpKQorICAgICAgICAgICAgICAgIChub3QgKGFueSAjJ2ZseXNwZWxsLW92ZXJs
YXktcCAob3ZlcmxheXMtYXQgcG9zKSkpKSkKICAgICAoZ290by1jaGFyIHBvcykKLSAgICAod2hl
biBwcmV2aW91cwotICAgICAgKGZvcndhcmQtd29yZCAtMSkpCiAgICAgOzsgU2F2ZSB0aGUgY3Vy
cmVudCBsb2NhdGlvbiBmb3IgbmV4dCBpbnZvY2F0aW9uLgogICAgIChzZXRxIGZseXNwZWxsLW9s
ZC1wb3MtZXJyb3IgKHBvaW50KSkKICAgICAoc2V0cSBmbHlzcGVsbC1vbGQtYnVmZmVyLWVycm9y
IChjdXJyZW50LWJ1ZmZlcikpCi0tIAoyLjUyLjAKCg==
--000000000000f2bb600644ee97fb--



------------=_1764850922-20161-1--



Last modified: Thu, 4 Dec 2025 12:30:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.