From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yikai Zhao Newsgroups: gmane.emacs.bugs Subject: bug#59678: [PATCH] sh-script: use completion-table-with-cache to improve performance Date: Sat, 3 Dec 2022 01:01:32 +0800 Message-ID: References: <20221129143013.191469-1-yikai@z1k.dev> <83wn7bgm9y.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6894"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 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 18:03:07 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 1p19RL-0001be-6w for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Dec 2022 18:03:07 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p19QK-00010A-Ug; Fri, 02 Dec 2022 12:02:04 -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 1p19QJ-0000yI-1R for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 12:02:03 -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 1p19QI-0006Om-Mg for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 12:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p19QI-0007Um-It for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 12:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yikai Zhao Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Dec 2022 17:02: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.167000051328805 (code B ref 59678); Fri, 02 Dec 2022 17:02:02 +0000 Original-Received: (at 59678) by debbugs.gnu.org; 2 Dec 2022 17:01:53 +0000 Original-Received: from localhost ([127.0.0.1]:47735 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p19Q9-0007UX-3w for submit@debbugs.gnu.org; Fri, 02 Dec 2022 12:01:53 -0500 Original-Received: from mail-pj1-f41.google.com ([209.85.216.41]:51808) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p19Q4-0007UR-OU for 59678@debbugs.gnu.org; Fri, 02 Dec 2022 12:01:52 -0500 Original-Received: by mail-pj1-f41.google.com with SMTP id cm20so5498250pjb.1 for <59678@debbugs.gnu.org>; Fri, 02 Dec 2022 09:01:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=z1k.dev; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=i8Y0Gn3eVDjgu4vtpcTAIEjpZuANW9xfs7DeARc6akI=; b=me6K8S3e58FAn3+H99Je9WT3YwkULLQx5rrctqoTDycr8sdOvirp83NWZ2PN2FmGpg +xB1W12UTKlsMbS6RsUKwTA4XPBX/zeT5B9bOHfAvZ04zUHma2rVQJNKObbtYJA0FT/i VZ9LkOBu/ObzxEMDpo68BEd7CSuk6WIQ/fB+Y8vq87xeUUWTiBPLoOcN5hpDMniZYYEo dexWmMGaAmQrUjvQuc6DNpqngo4McWq4tLtHocs/fNNGco+kRn0Xj82CwsndJVGPzi/L KzMw7bQHws1h4Q3BTgkbSkw7rNKm5d6jz70SYG4QxS3hhTK4xbLRhNjwdHVQYOt7W/NQ wc0Q== 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=i8Y0Gn3eVDjgu4vtpcTAIEjpZuANW9xfs7DeARc6akI=; b=t3daPDQ6OhZ994o+RErenGjh1zwaA1aLY+I2h3wp1CM5bb8c+j6jxrQbkiVYZ5DI2Z 1Cw8+w7wmfoBds5JjSiXq/7OEa4sehZtPmMXhSc2EOYHwcGH2pze9iRQ8Wx6ecjJ7Cpn +4Z7V5zf89ReD6GOQq05z8wWnYJHiNVRfVGPeEvV9aa3c5GNac+a/qlPJkpT+FijEqro u+phsfFxNGuU5WHiDBUC4XKP23ZgUjcx2J1UZaGp7RzbBC741D6/YMxhoiC2DrLUYYp2 Hhg2yxr3WHE+zXtVxjOf6bpRjvN4GRjNRQ5f23+k9wTRyZx2RVZfyfZ3r+Zic6V5H2Om nzDQ== X-Gm-Message-State: ANoB5pkXy4XPzLv/lMZm/gx6pTF/uQwC4pOxyW6isL7DYqC/x07xtqUH +hcmiMFs+HQvQeH+CPWhMx8JFNYUdjx/BUzZBgcNmg== X-Google-Smtp-Source: AA0mqf7brKho3mn3aSiAOWoe1gnQ72EGgkPj3FNEXTS+cqtDH0UQ3NH6yzdO89frAxwCfWUQ9hIpw2RipubWWf9nRNk= X-Received: by 2002:a17:902:e80f:b0:188:f571:cea2 with SMTP id u15-20020a170902e80f00b00188f571cea2mr56320157plg.146.1670000503052; Fri, 02 Dec 2022 09:01:43 -0800 (PST) In-Reply-To: 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:249769 Archived-At: On Fri, Dec 2, 2022 at 4:30 AM Stefan Monnier wrote: > > >> 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 again confirmed that this is the current behavior. I created an issue for company-mode to follow up. https://github.com/company-mode/company-mode/issues/1351 > > > Stefan >