[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix python-info-current-defun performance for large defuns
From: |
Tom Gillespie |
Subject: |
Re: [PATCH] Fix python-info-current-defun performance for large defuns |
Date: |
Fri, 15 Sep 2023 11:20:16 -0700 |
Here's an updated patch with the fix and additional test for the
case kobarity identified. I also shortened the long lines. Best!
Tom
On Thu, Sep 14, 2023 at 11:56 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> 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 <kobarity@gmail.com>
> > Cc: emacs-devel@gnu.org
> >
> >
> > 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.
> >
0001-Fix-python-info-current-defun-performance-for-large-.patch
Description: Text Data