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.devel Subject: Re: [PATCH] Fix python-info-current-defun performance for large defuns Date: Fri, 15 Sep 2023 09:56:17 +0300 Message-ID: <83zg1nkjqm.fsf@gnu.org> References: <83h6oa5fbd.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10388"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: tgbugs@gmail.com, kobarity Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 15 08:56:56 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qh2l5-0002U6-Sk for ged-emacs-devel@m.gmane-mx.org; Fri, 15 Sep 2023 08:56:56 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qh2kd-0003QN-2J; Fri, 15 Sep 2023 02:56:27 -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 1qh2kb-0003Q0-Op for emacs-devel@gnu.org; Fri, 15 Sep 2023 02:56:25 -0400 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 1qh2kb-0008U2-GQ; Fri, 15 Sep 2023 02:56:25 -0400 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=lo4iGn+NCf0lpNt+KZyz4ZFlnZV5ETFxvJTJV/qn3fI=; b=NUcK5bBSAQlY h18ZtlwSN1AXw1K/LyR/VWi6RWXAA8bYKcqPbET2Qkl0Jo263xpgl7mrtg1JxyXCxb7yIXDCuyUuf oHqeuJdYnsQS7sQY3sXX5OuHaeVN8f0wPE+HtAkGLC7hOHo0/rwS5ShTH2G1IDeEZkGJpc/UB1m+4 MVPVaQyoxtGvKLtC+6KzkWBtnXviaorrOAZwe9LGy1IpYqA1gUIp+b1lEinOwXEyNbBw6msvLefz8 ZSkOj1qKr6WWp84L9XxSDGvmDxZulWW5UXrDvIwv3qYNTIx+WQmAVTxiPxt/8eWseD6HPMC5+q/j8 BZdMGp8a8phhIVAzDRtyGg==; In-Reply-To: (message from kobarity on Tue, 05 Sep 2023 23:17:48 +0900) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:310591 Archived-At: Ping! Tom, could you please respond to the comments, and perhaps post an updated patch? I'd like to install this when it's ready. Thanks. > Date: Tue, 05 Sep 2023 23:17:48 +0900 > From: kobarity > Cc: emacs-devel@gnu.org > > > Eli Zaretskii wrote: > > > From: Tom Gillespie > > > Date: Sun, 3 Sep 2023 18:37:34 -0700 > > > > > > Hi, > > > Here is a patch to fix a performance issue in > > > python-info-current-defun that appears when the function > > > is run on large defuns. The issue can appear to the user as a > > > noticeable (~500ms) freeze when the point is in a large defun > > > in a python buffer with which-function-mode enabled. More > > > details in the commit message and comments in the code. > > > > > > I made the patch against the emacs-29 branch, but will also > > > on master without issue. > > > > Thanks. > > > > kobarity, any comments? > > Hi, > Thank you for the patch. I have tried it and have confirmed that it > improves performance. I think that not using the time-consuming > `python-nav-end-of-defun' has helped. > > However, I found one unexpected behavior. The following code is an > example added as an ERT: > > def a(): > def b(): return > if True: > def c(): return > > if True: > if True: > def d(): return > > In this example, `python-info-current-defun' seems to return "a" if > the point is on the second line from the bottom. Could you please > take a look? > > My personal impression is that 114 characters per line is a bit long. >