Subject: Re: bug#25122: 24.5; function describe-variable hangs on large variables

From: Michael Heerdegen <[email-masked]>
Date: Wed, 26 Apr 2017 05:57:47 +0200

Hi Noam,

> > I intend to close this bug as fixed after merging these, as this does
> > fix the performance bug.

I have a question: how much performance gain can I expect from your
changes?

My use case is the following: "el-search" has now an occur-like
operation mode.  It copies all matches (i.e. s-expressions) into an *El
Occur* buffer.  Matches can be tiny (like `1') or arbitrarily large.

Since most expressions don't start at column 0 in their source buffer
(unless they are top-level), I have to remove the amount of additional
indentation from all but the first line of a match.  Well - not from
all, that's where it gets complicated - there are cases where this is
wrong, like in strings and some comments.

To have a sane solution, I just used `indent-region' to reindent the
expression in the occur buffer.  This works great, but `indent-region'
was so slow that it took up to 50 percent of the whole running time of
the occur search.

With an naive alternative approach (just remove additional indentation
from lines where it makes sense (whereby finding out whether it "makes
sense" involves running syntax scanning)), I get an improvement of a
factor around five or ten relative to `indent-region' for reindenting.

Would you expect your improved `indent-region' is fast enough now so
that it makes sense that I switch back to it in my code?  Is the running
time now something close to O(number of lines to indent)?

Thanks,

Michael.