[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix python-info-current-defun performance for large defuns
From: |
kobarity |
Subject: |
Re: [PATCH] Fix python-info-current-defun performance for large defuns |
Date: |
Tue, 05 Sep 2023 23:17:48 +0900 |
User-agent: |
Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (Gojō) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
Eli Zaretskii wrote:
> > From: Tom Gillespie <tgbugs@gmail.com>
> > 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.