From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#59678: [PATCH] sh-script: use completion-table-with-cache to improve performance Date: Fri, 02 Dec 2022 15:45:14 +0200 Message-ID: <83h6ydgbrp.fsf@gnu.org> References: <20221129143013.191469-1-yikai@z1k.dev> <83wn7bgm9y.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3115"; mail-complaints-to="usenet@ciao.gmane.io" Cc: yikai@z1k.dev, 59678@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 02 14:47:01 2022 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 1p16NZ-0000aK-Hm for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Dec 2022 14:47:01 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p16NK-0003wI-At; Fri, 02 Dec 2022 08:46:46 -0500 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 1p16Me-0003pE-Ql for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 08:46:11 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p16Mc-0000JV-OT for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 08:46:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p16Mc-0005cV-Gt for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 08:46:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Dec 2022 13:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59678 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 59678-submit@debbugs.gnu.org id=B59678.166998874621588 (code B ref 59678); Fri, 02 Dec 2022 13:46:02 +0000 Original-Received: (at 59678) by debbugs.gnu.org; 2 Dec 2022 13:45:46 +0000 Original-Received: from localhost ([127.0.0.1]:46828 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p16ML-0005c8-GO for submit@debbugs.gnu.org; Fri, 02 Dec 2022 08:45:45 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48094) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p16MJ-0005c2-MH for 59678@debbugs.gnu.org; Fri, 02 Dec 2022 08:45:44 -0500 Original-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 1p16ME-0000Ha-Da; Fri, 02 Dec 2022 08:45:38 -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=Bg+BXkAeo84pS/l8rwu4nMQlnYjWLLWOW8sjV2IxO4o=; b=UDfu/rw2yOcW 68hpfi/1vF/f5hbPzT4WifcQJOnwdmcBLgLLtoDBZR//RgicoL9luYPN/kQYkPrxtttghB4uj7Wtm cmZ1ArBv8jkvFlWGv8MIlZAWNsTsFLJ+QAZ+d9wxJHu222Sk3A4h3EBzDgwze3GzogbYuVpmmSgLC LSJ1P5TIcb+0yJc+RBOF+Nn8UwljyV4XZYcFiIcs1FEsakb1G5t1tInd4GFCmtlv+QuTqLxDDn7Eb IK+QcJlzi65weniNSSqMvjQousrIOJ71Vwt3/44LjEbV9d4PYfuraIiJ/k7A8L4dCIPPRGwr5Gwq3 5C6aOHqoTCN0te2Uwpvw7A==; Original-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 1p16MD-0006L4-Ph; Fri, 02 Dec 2022 08:45:38 -0500 In-Reply-To: (message from Stefan Monnier on Thu, 01 Dec 2022 15:30:04 -0500) 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:249744 Archived-At: > From: Stefan Monnier > Cc: yikai@z1k.dev, 59678@debbugs.gnu.org > Date: Thu, 01 Dec 2022 15:30:04 -0500 > > >> I found that the auto-completion on .sh files (with company-mode) was > >> pretty slow (takes several seconds). It turns out that company-mode > >> would call the capf function with 'metadata action for each > >> candidate, where each function call would need to list all the > >> cmds. In this patch, I modified the code to use > >> completion-table-with-cache which fixes the problem for me. > > > > Stefan, any comments? > > Looks OK to me. The description of the problem looks concerning, tho: > if Company really calls the completion table with `metadata` once per > candidate, then there's a bug in company. Thanks, I therefore installed the changes.