From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: Too long completion delay time in LISP interaction mode. Date: Wed, 20 Oct 2021 14:42:29 +0800 Message-ID: References: <87tuhcs2ov.fsf@gnu.org> <87pms0s0ex.fsf@gnu.org> <87lf2orz4c.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="26411"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Tassilo Horn Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 20 08:43:25 2021 Return-path: Envelope-to: geh-help-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 1md5Js-0006ee-O5 for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 20 Oct 2021 08:43:24 +0200 Original-Received: from localhost ([::1]:45556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md5Jr-00055C-1R for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 20 Oct 2021 02:43:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md5JF-00054h-KV for help-gnu-emacs@gnu.org; Wed, 20 Oct 2021 02:42:45 -0400 Original-Received: from mail-ua1-x92b.google.com ([2607:f8b0:4864:20::92b]:43951) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1md5JC-0002CI-00; Wed, 20 Oct 2021 02:42:44 -0400 Original-Received: by mail-ua1-x92b.google.com with SMTP id i22so4616875ual.10; Tue, 19 Oct 2021 23:42:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=welXuFgyhzUqq3CFxkbs2loSGxNCj5bTccI3jFfx7Fg=; b=ZBWKYlgQBv9OY6QlBWSauQxRVgB5XggiwUcrRsMqP24FjGHs+L64H9dVjLNYJU/Ije d9qvIw3hVgKE14TxusGU4DIKMbNOgDvYExVz5EEzVPzAfZJHMXw6PBkfBTnyoW5qdSwQ hyduiGtmE3+bgsreFq+5P5hKu4imnjmbyDJBemetzTCMKwePH5Rhezl1Iwg7eCqQMgDQ gMpFCtfO1u/jcpWULLoGwHQ4q/RX1HO/9IJpPPCArIuFOrJJTQ4ZGj6zu2M+Z9GkIMJi 2ndjm1B/3P2mhcUkgpOT+7bPDn2j5jv8tt23nFSpA88znuRWL1PLfnjdTHGWdwoz4CtQ TJ0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=welXuFgyhzUqq3CFxkbs2loSGxNCj5bTccI3jFfx7Fg=; b=2KOmRHCQiTR6coLW6TiyVq58dxcd19EOrHOgHJsDeMuscrJ8OyiaLpa6pD7Jc5rUMG Lgd+VrVXt8cJNC8+bCkHP14HbQsj3qqTXle+G2GS1rcXENQkMB+fPcYUsSjvpTu6sTRM WTG4VDf99QrnoTYyho+8lTagE30OOjUp8PQK3XNiasFEJLkUzcWedXN5uMG6bPZPH4In AZQiIg5nR2xZgs7CVNeZSUg29mPqtd+wZuY9//3GM1Zhv602uzw/K0VPEa+ylOjAUh4s Mn1CY63A4qcMgeJTe+1IUaK86wxR+bGIy3gCllVOPkfKHZxGEwBAdVjzjgLqY/Ux+v5U rS2Q== X-Gm-Message-State: AOAM532AkXiNM8UpN0ECSt8Nbyyt+MKjLssR6agf9KdofywRIdEu/o4k E/PyyZydbEx5nJkGWgoptoWPfwklEd3P0hJK23H5fVbUrUfTVjM2 X-Google-Smtp-Source: ABdhPJwlGHZEsUEJ76yo6UyQvjFeC6wXiSdhieXyq58I9+lNO0W3wxOCX8HIg+vPlwBK2F2LmVxgedEWT4RX1MUdhBg= X-Received: by 2002:a67:d91b:: with SMTP id t27mr41590512vsj.55.1634712160508; Tue, 19 Oct 2021 23:42:40 -0700 (PDT) In-Reply-To: <87lf2orz4c.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::92b; envelope-from=hongyi.zhao@gmail.com; helo=mail-ua1-x92b.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-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:133910 Archived-At: On Wed, Oct 20, 2021 at 2:25 PM Tassilo Horn wrote: > > Hongyi Zhao writes: > > >> So the bottleneck is in the lambda which you didn't expand. > > > > I disabled hotfuzz now, and the following result is obtained by > > profiling the CPU with the same steps as described above: > > > > 472 88% - command-execute > > 472 88% - funcall-interactively > > 472 88% - counsel-M-x > > 472 88% - let > > 448 84% - ivy-read > > 448 84% - apply > > 444 83% + # > > 4 0% + my/company--transform-candidates > > 24 4% + counsel--M-x-externs > > 45 8% + ... > > 15 2% + redisplay_internal (C function) > > Well, again you didn't expand the lambda where most of the time is > spent... To be frank, I don't know how to expand it. > >> But I'm also not sure if you are profiling the right thing because I > >> don't think that in-buffer completion (in terms of > >> `completion-at-point-functions') starts with M-x (or counsel-M-x). > > > > I'm not sure if it's relevant to the following configuration in my > > `~/.emacs.d/init.el': > > I also use corfu but I think now I know what happens. The thing is that > doing M-x profiler-report RET takes much longer (88% of the profiling > time) than computing the completion candidates. That is done in the > > 45 8% + ... > > part which you should also expand. Again, I don't know how to expand it. > When I do your recipe, the first 54% part is also the M-x > profiler-report RET part, and the > > 327 45% - ... > > is the actual completion part (using vertico). I don't use corfu [1] and vertico [2], but thank you for letting me your configuration. [1] https://github.com/minad/corfu [2] https://github.com/minad/vertico > --8<---------------cut here---------------start------------->8--- > 391 54% - command-execute > 391 54% - call-interactively > 390 53% - byte-code > 390 53% - read-extended-command > 390 53% - completing-read > 390 53% - completing-read-default > 390 53% - apply > 390 53% - vertico--advice > 390 53% - apply > 390 53% - # > 375 51% - read-from-minibuffer > 357 49% + vertico--exhibit > 5 0% + command-execute > 1 0% + funcall-interactively > 327 45% - ... > 265 36% - or > 265 36% - if > 265 36% - let* > 260 35% - unwind-protect > 260 35% - progn > 129 17% + corfu--recompute-candidates > 121 16% + let* > 10 1% + if > 5 0% + if > 62 8% Automatic GC > 5 0% + timer-event-handler > --8<---------------cut here---------------end--------------->8--- Anyway, after disabling the hotfuzz, the completion delay has been reduced to an acceptable time. [3] https://github.com/axelf4/hotfuzz HZ