From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 14 03:15:46 2023 Received: (at submit) by debbugs.gnu.org; 14 Jan 2023 08:15:46 +0000 Received: from localhost ([127.0.0.1]:53242 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGbhZ-0003MV-D9 for submit@debbugs.gnu.org; Sat, 14 Jan 2023 03:15:46 -0500 Received: from lists.gnu.org ([209.51.188.17]:36356) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGbXm-00037x-KW for submit@debbugs.gnu.org; Sat, 14 Jan 2023 03:05:39 -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 ) id 1pGbXl-0000NR-Or for bug-gnu-emacs@gnu.org; Sat, 14 Jan 2023 03:05:38 -0500 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGbXj-0004SU-P6 for bug-gnu-emacs@gnu.org; Sat, 14 Jan 2023 03:05:37 -0500 Received: by mail-ej1-x631.google.com with SMTP id az20so38152243ejc.1 for ; Sat, 14 Jan 2023 00:05:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=BvHikAd1mvKQ/ENkSbAFSQJeZBdsVbuOLMbjcIQSQZk=; b=olYSrxZjLub5jOXtFO1hygNcz0sq55zGly8ide5MKl9VP0UkIfiehTiLS8hiGc9tfL ahuTyfgL7zF2QUzk3tbIds/dONekxF+u4UrZ2G/nydYaqypUWyjBCXUs63/rtwIK2eX8 0tVlroFKrllxbnvlWJdi2X5atI13qJrk8AgwNTL1lkRygz6VwVyOKQtcqJEtDvBrCFZB ZYOdAK6o5PlraGwMYQewKo5sdCavCRCcKfst24+EYpkYT70R/sYZIcbLu69o8FCVtsUG GfQY0mTpU3pE34E6r2u9ncstlywsS7Qf2JmiNF7UrlzLwwdZ90lbvKuadZBt2No6v3SZ UAPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=BvHikAd1mvKQ/ENkSbAFSQJeZBdsVbuOLMbjcIQSQZk=; b=S6+1EY7e16E/BC1AsJOZRG+6N33RpWrSRaAosxLsXUO/6G3arrgcOdfGuMl/GHpNxu V6nK+ArMAAVkIt8fq6uDTqOqxS+svZrC2RYoXmH+ffSsJdTXRD1PfQn0BNd9oyZzrJxw m1Zagv7rzUFlyjd/F/rKPUIhE7Y3VvfGutquK6T6yi9jaIqA7HYRsDtTA/79FwcTuq0Z FXyUZ5Ykj+ClQBIN8I4+JVhrM/gE6xmKnctXZP88rBmnmC/qMt98eNpZwVh3A3TM2luI +zIpRFtl2TwEGdeCY6jN81VYhtjsqyO0PQUDCppxSoX8fq4C3kFkhV3W9QTlIQH91bed wIQQ== X-Gm-Message-State: AFqh2krYRU2NMKG0zrjHvkQmlG8KWNLis94d7/8eEm5uHGWh+/QJrndD XFGz8qcghRVU4lWS7OAClrO3QhH9ZbHr7iC/hICg7jmt/V4= X-Google-Smtp-Source: AMrXdXv3YY3wymQkn3dl6OvegexI6vWe/eSl0fCksZCS2cU1UZ57wq9Vf52CEcDi5GeY7AgGV3zRUAR6pjLhftzBghg= X-Received: by 2002:a17:906:3049:b0:844:436f:8c35 with SMTP id d9-20020a170906304900b00844436f8c35mr7653296ejd.12.1673683532787; Sat, 14 Jan 2023 00:05:32 -0800 (PST) MIME-Version: 1.0 From: Allen Wang Date: Sat, 14 Jan 2023 00:07:31 -0800 Message-ID: Subject: 30.0.50; `while-no-input' in GUI(macOS) is much slower than emacs -nw To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="0000000000007035a505f234d022" Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=allenhw1996@gmail.com; helo=mail-ej1-x631.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=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.1 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 14 Jan 2023 03:15:42 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) --0000000000007035a505f234d022 Content-Type: text/plain; charset="UTF-8" Hi maintainers, To reproduce, I evaluated these in the scratch buffer. (defun sayhi (&rest _) (while-no-input (dotimes (_ 10000000) (random))) (message "Done.")) (add-hook 'post-command-hook 'sayhi) After `C-x C-e`-ing the last line, I kept typing some arbitrary text at a normal speed. With `emacs -Q -nw`, the last character shows up pretty much immediately after the new key is pressed (as I expect). In GUI, however, there is significant delay. Say if I type "hello world", then maybe "h" and "e" would show up, then nothing happens for a few seconds, then the rest would "burst out". I'm not sure if this is considered a "bug", so sorry if this isn't the right place to report this. But after looking at documentation and a few other bug reports, it sounds like people expect `while-no-input' to work in this scenario? Also I see completion packages like Corfu and Vertico wrap things in this macro in the post-command-hook, and despite them doing that, auto-completion is still quite laggy for me, _only_ when in GUI. If this is not a bug, where should I submit a feature request? Either way, thanks for your time. Allen --- In GNU Emacs 30.0.50 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G9323)) of 2023-01-13 built on Allens-MacBook-Air.local Repository revision: 99120491730c5839a5ba15ded187d481af1e71a7 Repository branch: master Windowing system distributor 'Apple', version 10.3.1671 System Description: Mac OS X 10.14.6 Configured using: 'configure CPPFLAGS=-I/usr/local/opt/curl/include LDFLAGS=-L/usr/local/opt/curl/lib' Configured features: ACL GIF GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP XIM ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads kqueue cocoa ns lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 37461 8829) (symbols 48 5061 0) (strings 32 13063 2251) (string-bytes 1 377288) (vectors 16 10360) (vector-slots 8 162082 5991) (floats 8 21 23) (intervals 56 219 0) (buffers 976 10)) --0000000000007035a505f234d022 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi maintainers,

To reproduce= , I evaluated these in the scratch buffer.

=C2= =A0=C2=A0=C2=A0 (defun sayhi (&rest _)
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (while-no-input
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (dotimes = (_ 10000000)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (ran= dom)))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (message "Done."))

=C2=A0=C2=A0=C2=A0 (add-hook 'post-command-hook= 'sayhi)

After `C-x C-e`-ing the last line= , I kept typing some arbitrary text at a normal speed.

=
With `emacs -Q -nw`, the last character shows up pretty much immediate= ly after the new key is pressed (as I expect). In GUI, however, there is si= gnificant delay. Say if I type "hello world", then maybe "h&= quot; and "e" would show up, then nothing happens for a few secon= ds, then the rest would "burst out".

I&#= 39;m not sure if this is considered a "bug", so sorry if this isn= 't the right place to report this. But after looking at documentation a= nd a few other bug reports, it sounds like people expect `while-no-input= 9; to work in this scenario? Also I see completion packages like Corfu and = Vertico wrap things in this macro in the post-command-hook, and despite the= m doing that, auto-completion is still quite laggy for me, _only_ when in G= UI. If this is not a bug, where should I submit a feature request?

Either way, thanks for your time.

=
Allen

---

In GNU= Emacs 30.0.50 (build 1, x86_64-apple-darwin18.7.0, NS
appkit-1671.60 Ve= rsion 10.14.6 (Build 18G9323)) of 2023-01-13 built on
Allens-MacBook-Air= .local
Repository revision: 99120491730c5839a5ba15ded187d481af1e71a7
= Repository branch: master
Windowing system distributor 'Apple', = version 10.3.1671
System Description: =C2=A0Mac OS X 10.14.6

Conf= igured using:
'configure
CPPFLAGS=3D-I/usr/local/opt/curl/include=
LDFLAGS=3D-L/usr/local/opt/curl/lib'

Configured features:ACL GIF GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY KQUEUE NSPDUMPER PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP XIM ZLIB
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-s= ystem: utf-8-unix

Major mode: Lisp Interaction

Minor modes in= effect:
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
sho= w-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-b= ar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-l= ock-mode: t
font-lock-mode: t
blink-cursor-mode: t
line-number-mod= e: t
indent-tabs-mode: t
transient-mark-mode: t
auto-composition-m= ode: t
auto-encryption-mode: t
auto-compression-mode: t

Load-p= ath shadows:
None found.

Features:
(shadow sort mail-extr emac= sbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml= -sec password-cache epa derived epg rfc6068
epg-config gnus-util text-pr= operty-search time-date subr-x mm-decode
mm-bodies mm-encode mail-parse = rfc2231 mailabbrev gmm-utils mailheader
cl-loaddefs cl-lib sendmail rfc2= 047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils rmc iso-transl tool= tip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-t= ype elisp-mode mwheel
term/ns-win ns-win ucs-normalize mule-util term/co= mmon-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list rep= lace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu= -bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock= font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq= simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-l= ang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp5193= 2 hebrew greek
romanian slovak czech european ethiopic indian cyrillic c= hinese
composite emoji-zwj charscript charprop case-table epa-hook
jk= a-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
th= eme-loaddefs faces cus-face macroexp files window text-properties
overla= y sha1 md5 base64 format env code-pages mule custom widget keymap
hashta= ble-print-readable backquote threads kqueue cocoa ns lcms2
multi-tty mak= e-network-process emacs)

Memory information:
((conses 16 37461 88= 29)
(symbols 48 5061 0)
(strings 32 13063 2251)
(string-bytes 1 37= 7288)
(vectors 16 10360)
(vector-slots 8 162082 5991)
(floats 8 21= 23)
(intervals 56 219 0)
(buffers 976 10))
--0000000000007035a505f234d022-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 14 20:37:00 2023 Received: (at 60810) by debbugs.gnu.org; 15 Jan 2023 01:37:01 +0000 Received: from localhost ([127.0.0.1]:55837 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGrxE-0007yx-LA for submit@debbugs.gnu.org; Sat, 14 Jan 2023 20:37:00 -0500 Received: from sonic302-20.consmr.mail.ne1.yahoo.com ([66.163.186.146]:37420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGrxD-0007yi-9f for 60810@debbugs.gnu.org; Sat, 14 Jan 2023 20:37:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1673746611; bh=8VsU3xtNMjwQuhOmGhQauvH0uMDBNaRZ52DT4f2ao/s=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=G62jyHtYBIOjC+adI5KqKosdm+C9I9aB4jLPN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Sun, 15 Jan 2023 01:36:51 +0000 Received: by hermes--production-sg3-5ff5bbd69d-r9zfq (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 78d3c895f8ef64d8454e92e4fa129856; Sun, 15 Jan 2023 01:36:44 +0000 (UTC) From: Po Lu To: Allen Wang Subject: Re: bug#60810: 30.0.50; `while-no-input' in GUI(macOS) is much slower than emacs -nw In-Reply-To: (Allen Wang's message of "Sat, 14 Jan 2023 00:07:31 -0800") References: User-Agent: Gnus/5.13 (Gnus v5.13) Date: Sun, 15 Jan 2023 09:36:24 +0800 Message-ID: <87bkn0bmuf.fsf@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.21062 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 1632 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 60810 Cc: 60810@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Allen Wang writes: > Hi maintainers, > > To reproduce, I evaluated these in the scratch buffer. > > (defun sayhi (&rest _) > (while-no-input > (dotimes (_ 10000000) > (random))) > (message "Done.")) > > (add-hook 'post-command-hook 'sayhi) > > After `C-x C-e`-ing the last line, I kept typing some arbitrary text at a normal speed. > > With `emacs -Q -nw`, the last character shows up pretty much immediately after the new key is pressed (as I expect). In GUI, however, there is > significant delay. Say if I type "hello world", then maybe "h" and "e" would show up, then nothing happens for a few seconds, then the rest > would "burst out". > > I'm not sure if this is considered a "bug", so sorry if this isn't the right place to report this. But after looking at documentation and a few other > bug reports, it sounds like people expect `while-no-input' to work in this scenario? Also I see completion packages like Corfu and Vertico wrap > things in this macro in the post-command-hook, and despite them doing that, auto-completion is still quite laggy for me, _only_ when in GUI. If > this is not a bug, where should I submit a feature request? Thanks. This problem is because the NS port does not support interrupt-based input, because of limitations in Apple's toolkit. This means Emacs is not notified immediately about new input while it is executing Lisp, and instead has to periodically check every 1 second. To decrease the amount of time between each check, make `polling-period' smaller. However, that will increase Emacs's CPU usage, even when idle. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 02:08:24 2023 Received: (at 60810) by debbugs.gnu.org; 15 Jan 2023 07:08:24 +0000 Received: from localhost ([127.0.0.1]:56021 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGx7w-00007b-8U for submit@debbugs.gnu.org; Sun, 15 Jan 2023 02:08:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50954) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGx7u-00007K-B0 for 60810@debbugs.gnu.org; Sun, 15 Jan 2023 02:08:22 -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 ) id 1pGx7o-0001wn-Lf; Sun, 15 Jan 2023 02:08:16 -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=fVcW3xijgyKJJS/Dpy6z5FZPmkz7VqCHEdLwXy/N7gA=; b=WML2Er2ep+U+ ZX7NkuR1wDQgZyfWUgytJRnzPJ4C0sNy4zNooBqM+yHAgk/8pU+llCZzRRIkMNyTDnXpqAmPKdSZH vNQn3wcQaHz/N4+4sOdOQoG3Xwl/5STyoSoxH7g788mTF0AvhQlUeAPsgTbJSrjI3B4YnKItHbhaA +gAK4PovNyuQa/aDvjbP0CF2LETWuvJEBFNh/Ap4YsITFFYIs9AenyMij/dgrwxVGSYAxPbTZjyW1 FwcMI1LCMk+3LfbfSfei2sVL6quwiptXMOzWDgvJAvW2SuDR5Bjsd8iV9NO5Jqq0rPrZaAk26QyKi gGc49w4NLjAu0Cx1tC1dWw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGx7k-00049v-IV; Sun, 15 Jan 2023 02:08:14 -0500 Date: Sun, 15 Jan 2023 09:08:17 +0200 Message-Id: <83358c6zry.fsf@gnu.org> From: Eli Zaretskii To: Po Lu In-Reply-To: <87bkn0bmuf.fsf@yahoo.com> (bug-gnu-emacs@gnu.org) Subject: Re: bug#60810: 30.0.50; `while-no-input' in GUI(macOS) is much slower than emacs -nw References: <87bkn0bmuf.fsf@yahoo.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60810 Cc: allenhw1996@gmail.com, 60810@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 60810@debbugs.gnu.org > Date: Sun, 15 Jan 2023 09:36:24 +0800 > From: Po Lu via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > Thanks. This problem is because the NS port does not support > interrupt-based input, because of limitations in Apple's toolkit. > > This means Emacs is not notified immediately about new input while it is > executing Lisp, and instead has to periodically check every 1 second. Does NS use a separate thread to handle input events? If so, could that separate thread set quit-flag when we are under throw-on-input, if it detects a suitable input event? The w32 port does that, see signal_user_input in w32fns.c. This should allow the Lisp thread detect that input is pending in a more timely fashion. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 04:41:48 2023 Received: (at 60810) by debbugs.gnu.org; 15 Jan 2023 09:41:48 +0000 Received: from localhost ([127.0.0.1]:56145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGzWO-0006JO-CM for submit@debbugs.gnu.org; Sun, 15 Jan 2023 04:41:48 -0500 Received: from sonic316-22.consmr.mail.ne1.yahoo.com ([66.163.187.148]:42626) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGzWK-0006J8-UH for 60810@debbugs.gnu.org; Sun, 15 Jan 2023 04:41:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1673775697; bh=fN4SfXxvKe1iw2YVhLvA9efLDxUZbkK3HZxgbPTZ0W8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=aebYdnkdJakx1FYpRZMQq675IATW1yLBud3K3ws/7neaMsuxS4FL5KjK+n/+VIPPO+ClG/JVLH+lVn3kHNQPl6BNuNkvHDmj/mdwJZVyxNPcOCqCrxCWw9Y85FA4jWn8JmPw8N4Z5JihbZPNWpeM6zlfBnIlQImWUBzKpe0mnashQLoTcLDdkHXx2AaI6XOfETQmJEX0Dm7fyOaVWjx6hNybN4YaGD5gIk5YhTEPh9dLYSmPXoiUbQiJlxAuS1nkRQDzhDUnu33OdHAprzGuk1mUodWx72Gm/YpPQCUWLDry8CCI5zdPD9uYOCIYLLH/SXzo9+N7Wm2Ej8Wg7I4X/A== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1673775697; bh=8wOLBvr41QuBqeN2tiw/LEbbbQrF/QXVXcxI0ElGiwN=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=uOTSTDjf4F5BmAD7jH0hCbSu+TqicpiD48BiDBQOhCdtl1VkFNgJWkdRDRY2MmbpT9HM+DHHS3MvkcKrhBtN8/mCc1yaK8FHierRjCqrvgDT3HeGGGGWueE0VpYjzss0GaTlx1nOh5V2a54vVdTmGwmTRb7OSXpy4eMXMgjWdlj4qg0G+n9pD69f9KEKahOooUexPpo5g/7fl2R5+t1uUEJ9BafCbDJtu4Z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3UOaxsJGZl2LYbRvzBBzO.UC7XFOOeP.P0Rkjh pZiIl1CSzfyJVs2ht3guGt_qGN3xnuK5LW14lA9xNwNozDSbuC6ThFGVvAdHPfXBQ5bNMUKpnqVZ ke1z5U_vbaOuRgwDZT.wKLSNJeC.zLL5p6VPalShYKfQfIEvTwZ.C33OQczt98XM2wv8ObyUwlMq 0bAGPPAXSJVVnaUkTxgkghTisSd9TxE_fzL4Iu1Dl_jbzw_.tFAw3QRjiRMY4XKlwL3MNMH_mD08 KZpbwrQGcD5zZiDju8xbFxIrG68_gLZYpmInech0I1LuFPvu7XGVaXe8N5WA45GY4Z8E- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.ne1.yahoo.com with HTTP; Sun, 15 Jan 2023 09:41:37 +0000 Received: by hermes--production-sg3-5ff5bbd69d-52bcn (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID b8e5c20dfb6ca463d4602b7464a6e2b3; Sun, 15 Jan 2023 09:41:32 +0000 (UTC) From: Po Lu To: Eli Zaretskii Subject: Re: bug#60810: 30.0.50; `while-no-input' in GUI(macOS) is much slower than emacs -nw In-Reply-To: <83358c6zry.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 15 Jan 2023 09:08:17 +0200") References: <87bkn0bmuf.fsf@yahoo.com> <83358c6zry.fsf@gnu.org> Date: Sun, 15 Jan 2023 17:41:26 +0800 Message-ID: <874jssb0e1.fsf@yahoo.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.21062 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 574 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 60810 Cc: allenhw1996@gmail.com, 60810@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: > Does NS use a separate thread to handle input events? Unfortunately not. > If so, could that separate thread set quit-flag when we are under > throw-on-input, if it detects a suitable input event? The w32 port > does that, see signal_user_input in w32fns.c. This should allow the > Lisp thread detect that input is pending in a more timely fashion. I understand that approach, it's taken in the Android port as well. Unfortunately, it cannot work because the NS port currently runs in the same thread that Lisp runs in. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 15:46:54 2023 Received: (at 60810) by debbugs.gnu.org; 15 Jan 2023 20:46:54 +0000 Received: from localhost ([127.0.0.1]:59610 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pH9u2-0000c0-6R for submit@debbugs.gnu.org; Sun, 15 Jan 2023 15:46:54 -0500 Received: from mail-ej1-f48.google.com ([209.85.218.48]:46816) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pH9u0-0000bm-E3 for 60810@debbugs.gnu.org; Sun, 15 Jan 2023 15:46:53 -0500 Received: by mail-ej1-f48.google.com with SMTP id qx13so5422647ejb.13 for <60810@debbugs.gnu.org>; Sun, 15 Jan 2023 12:46:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=gtcFbLs9KvZJh+q+XlD/PParV+2omC1ndrGls2vPSGI=; b=bldKFGAJCYknV4cPiKyNtqSUg0ZhHreaMUHjQUUCDddmePMbYPy9QLYOBOx1AqCIB3 9uJNSPUdG/Sb4xGQP5vE0mZkc6BZfTT6Kc7u8zqQ/lPnZ6ldKyEPTClrlfo1EQZ8KLYT 1+yuP65RwKEbTK2mfEsSh66qiHgJzHH8HyihEl1gtn2EDHIV4IxKVJWVinmxKPltfyYG oMctu+VlrYbd6QDrQh7CsKfpJcQZfgdxAKIazfFIexdX7dfKVHCR83d3MPc1TKiQdoXU SX/ckPJgeV7uwGo2NuFFy5udXvuS1eHZHbgroVh/5b7wKcpz4nW0PkKriNBZbxUd7/vm /wGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gtcFbLs9KvZJh+q+XlD/PParV+2omC1ndrGls2vPSGI=; b=69sqZJgJk/ZJNB7POibjSZGV4k5DKd/G7JyzHcZmPC0mNWJVW+UX2bKxcyCnqOf4gM NAwSChQdExBa3fREVpBsGLY86eBOp/G5dCgkk8ZQ2UqFM3K0ku1boVXwY2N46iQKziub xCwMVBpOSJXXVtF+FLqiU1rExEchnSuaLkvaHjW+jPHKexBlBGGAlAvyoFbixDB+xL0M DiE86wJD6tTyViUOn1ifY7efBNrt9Vguzeqw7Yy3Mbsw7ZxtWWx20ATCgL/XxU9evRTe noWU61qoE71Wca843CsGBmvxQh7Ke48/9ZgpuPDowxmK/hZxq34/DtpzcvtkwL01glhz ofNQ== X-Gm-Message-State: AFqh2koYSgaZGPXxt3ieUOg8zX3wllAQvuBBxpXpl1vNg1m35DRJasGk qCpSOXOjt4YhOdo0x1+k5zkwdn67B0NYcfvedVA= X-Google-Smtp-Source: AMrXdXvTUwLuA54PeVO01zu3SbZjnIXpdF0aBXj09L+lb7a2OMNkkpCqwDYkHmpqzO2WqYfzk34OjompfHVLJAk/9kM= X-Received: by 2002:a17:906:b850:b0:867:172b:c915 with SMTP id ga16-20020a170906b85000b00867172bc915mr1496643ejb.267.1673815606269; Sun, 15 Jan 2023 12:46:46 -0800 (PST) MIME-Version: 1.0 References: <87bkn0bmuf.fsf@yahoo.com> <83358c6zry.fsf@gnu.org> <874jssb0e1.fsf@yahoo.com> In-Reply-To: <874jssb0e1.fsf@yahoo.com> From: Allen Wang Date: Sun, 15 Jan 2023 12:48:59 -0800 Message-ID: Subject: Re: bug#60810: 30.0.50; `while-no-input' in GUI(macOS) is much slower than emacs -nw To: Po Lu Content-Type: multipart/alternative; boundary="000000000000a19abe05f2539030" X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 60810 Cc: Eli Zaretskii , 60810@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --000000000000a19abe05f2539030 Content-Type: text/plain; charset="UTF-8" Thank you for the quick response and the info. Sounds like this can't be fixed easily; I'll see if polling-period works for me. On Sun, Jan 15, 2023 at 1:41 AM Po Lu wrote: > Eli Zaretskii writes: > > > Does NS use a separate thread to handle input events? > > Unfortunately not. > > > If so, could that separate thread set quit-flag when we are under > > throw-on-input, if it detects a suitable input event? The w32 port > > does that, see signal_user_input in w32fns.c. This should allow the > > Lisp thread detect that input is pending in a more timely fashion. > > I understand that approach, it's taken in the Android port as well. > Unfortunately, it cannot work because the NS port currently runs in the > same thread that Lisp runs in. > > Thanks. > --000000000000a19abe05f2539030 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you for the quick response and= the info. Sounds like this can't be fixed easily; I'll see if poll= ing-period works for me.

On Sun, Jan 15, 2023 at 1:41 AM Po Lu <luangruo@yahoo.com> wrote:
Eli Zaretskii <eliz@gnu.org> writes:<= br>
> Does NS use a separate thread to handle input events?

Unfortunately not.

> If so, could that separate thread set quit-flag when we are under
> throw-on-input, if it detects a suitable input event?=C2=A0 The w32 po= rt
> does that, see signal_user_input in w32fns.c.=C2=A0 This should allow = the
> Lisp thread detect that input is pending in a more timely fashion.

I understand that approach, it's taken in the Android port as well.
Unfortunately, it cannot work because the NS port currently runs in the
same thread that Lisp runs in.

Thanks.
--000000000000a19abe05f2539030--