From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sean Whitton Newsgroups: gmane.emacs.bugs Subject: bug#72826: 30.0.90; icomplete-in-buffer becomes unusably slow in large Eshell Date: Thu, 03 Oct 2024 22:28:49 +0800 Message-ID: <8734ldxntq.fsf@melete.silentflame.com> References: <87seuqjuk4.fsf@melete.silentflame.com> <86r0aai1an.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21943"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , 72826@debbugs.gnu.org, Juri Linkov To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 03 16:30:15 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1swMqM-0005VH-9f for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Oct 2024 16:30:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swMqC-0005nL-AJ; Thu, 03 Oct 2024 10:30:04 -0400 Original-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 1swMq8-0005ma-Vh for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 10:30:01 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swMq8-0002JK-Mz for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 10:30:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=rK92orIZFnNxAtyVa8VT4TssDhOHFAZUCLOs81JlJCY=; b=YMiNpUw/dl3h2rOpUs7gjHTE6Naki+RZD9P4l9/fT0oQLYHOfwdSWN0PJ8h1/fgId89lUIpfXmX77RaCw7QQEQeSPKGRY2bloSe1xidtn+913FGkpj/SCE62hiCGdkv+u6C7nTovYzuprpYGK/o/E52zDO8bp8MHMFVp0YxklcIR92GiVpwmKiK4l2a2/LFfoDUC5UeoYgGQr0ocT05+NiGHczJiNFOwP9R5vgJEAxF4sqOq9KYxX9xBojWH0YPdnS/dr2CPoIG4AM2CY8F8sribfZ/wGcc5JqowsupNcG4ovSDd0aQLDzcu41y2TJDlM2TBI+2DXa/7phup9BM5iw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1swMqA-0007P0-BQ for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 10:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sean Whitton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Oct 2024 14:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72826 X-GNU-PR-Package: emacs Original-Received: via spool by 72826-submit@debbugs.gnu.org id=B72826.172796574428351 (code B ref 72826); Thu, 03 Oct 2024 14:30:02 +0000 Original-Received: (at 72826) by debbugs.gnu.org; 3 Oct 2024 14:29:04 +0000 Original-Received: from localhost ([127.0.0.1]:33661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swMpD-0007ND-Ks for submit@debbugs.gnu.org; Thu, 03 Oct 2024 10:29:03 -0400 Original-Received: from sendmail.purelymail.com ([34.202.193.197]:43998) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swMpB-0007Mi-1j for 72826@debbugs.gnu.org; Thu, 03 Oct 2024 10:29:02 -0400 DKIM-Signature: a=rsa-sha256; b=AIcGnLs1T2XGve1QmKYtIMWdMSEowDnr5AJuU4706CAvh8g5CzR5uK1sjq0THVsUHKxglnAoAW3a+kXNlMS/2czAt0YZSDzH4l3vwRiu+xzVOUlDnrwv35WMk/79w5d7/X1QnEYIt+UD4d2vMz9UzCv+A2mFvcUaWx3XETsqjXLZJ6YcOVyaixWTq9Inqm3lDMqlrcrQG7ZotIh4AJ2849hiaP7zhAecWcX3dV7SFpP4+DnEj5wsPkk+Z6ma/vjOM5PictaSXzbJVw8a+JRuj9EYeXHs3mYPt2iZVo519mm4nQ99Jnxf8LOuzBitjot2k7dP+lDuti7fBCqzRsNVQA==; s=purelymail2; d=spwhitton.name; v=1; bh=ldiQaC40z/MLR2nm8Po/9dRrLMKPMvJNTXrrl+ZMQL4=; h=Received:Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=NS9774+Zq8NVvRs9GeKknwjUcE+lJqzaDW+yIo9fGwnm8g2qA7jEGIy/9Cd9uvuRyCY7drFTPXSmMszmzQu1iuhfBlNX6SvaZyBXGobWEpc/slBK8fYsFI8wfIOIklgpk+cOrnuN9VfwTotahL+OrxMpDmdXRHV9bgLpB6xzelYb0JhSNjttrTh7VTHN4o6Q8+dHarTgmowUvEjn98d3NwvDMWGckBvExfrAdxylKs6FE7G0EmDIZSXaEqT04vGS3Kk4bJ4trd8xassEBtdzjXAakrNv77cddwP7cfMw2NfjQ+cTCv9FIz+vVdEFrgQwidOIcuROzoOXDjWPvSu3iQ==; s=purelymail2; d=purelymail.com; v=1; bh=ldiQaC40z/MLR2nm8Po/9dRrLMKPMvJNTXrrl+ZMQL4=; h=Feedback-ID:Received:Received:From:To:Subject:Date; Feedback-ID: 20115:3760:null:purelymail X-Pm-Original-To: 72826@debbugs.gnu.org Original-Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -352915128; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 03 Oct 2024 14:28:53 +0000 (UTC) Original-Received: by melete.silentflame.com (Postfix, from userid 1000) id 70A7A7E15B7; Thu, 3 Oct 2024 22:28:49 +0800 (CST) In-Reply-To: <86r0aai1an.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 27 Aug 2024 15:43:28 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292907 Archived-At: [CCing Juri and Jo=C3=A3o who have worked on this.] Hello, On Tue 27 Aug 2024 at 03:43pm +03, Eli Zaretskii wrote: >> From: Sean Whitton >> Date: Tue, 27 Aug 2024 15:26:03 +0800 >> >> Hello, >> >> 1. emacs -q >> 2. (setopt icomplete-in-buffer t) >> 3. M-x icomplete-mode >> 4. M-x eshell >> 5. cat very_large_file.txt # I'm using an 80k line log file >> 6. ls >> 7. Try to use C-, and C-. to cycle through the completions. >> =3D> Emacs basically locks up. >> >> The buffer being large should surely not affect icomplete-in-buffer in >> this way. It shouldn't need to care about all the rest of the buffer. > > Strangely enough, I can only reproduce this on GNU/Linux, but not on > MS-Windows. > > Profiling seems to indicate most of the time is spent in > completion-all-sorted-completions and in GC. I just tried profiling it myself: 38958 93% - icomplete-post-command-hook 38958 93% - icomplete-exhibit 38819 93% - icomplete-completions 38749 92% string-width 43 0% + icomplete--sorted-completions 27 0% buffer-string 139 0% + sit-for I think the culprit is probably the evaulation of (string-width (buffer-string)) in icomplete-completions. That'll always be fast for Icomplete in the minibuffer, but for icomplete-in-buffer it depends on the size of the buffer. I think this code is trying to determine how much space is taken up by the minibuffer prompt and the user's input typed so far. So, we can probably find a cheaper way to compute the corresponding value for icomplete-in-buffer. --=20 Sean Whitton