GNU bug report logs - #21077
24.5; Slow printing in inferior python buffer with python-shell-enable-font-lock

Previous Next

Package: emacs;

Reported by: Ista Zahn <istazahn <at> gmail.com>

Date: Thu, 16 Jul 2015 17:06:02 UTC

Severity: minor

Tags: fixed

Found in version 24.5

Fixed in version 25.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


Message #41 received at 21077 <at> debbugs.gnu.org (full text, mbox):

From: Ista Zahn <istazahn <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 21077 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#21077: 24.5; Slow printing in inferior python buffer with
 python-shell-enable-font-lock
Date: Fri, 31 Jul 2015 21:46:28 -0400
On Fri, Jul 31, 2015 at 6:07 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>>> As mentioned, font-lock is but one of the parts of Emacs that slow down
>>> as lines get longer.
>> I'm not all that concerned with things slowing down slightly,
>
> Neither am I.  All the others I care about also end up rendering
> Emacs unusable.  They just show up at different times, or start biting
> you at different line lengths.
>
>>> In the case of comint modes, rather than disable font-lock we should
>>> refrain from font-locking the text after the last \n (since that's the
>>> line that keeps getting expanded, so we end up re-font-locking it O(N)
>>> times for a line of length N, for a total amount of work of O(N^2)).
>>> IIRC I have a similar hack in grep.el or compile.el.
>> OK, but unless there are clear plans to fix this soon the default value of
>> python-shell-enable-font-lock should be changed to nil until such time as a
>> fix is in place.
>
> I disagree.  All comint modes suffer from this problem, AFAIK, and
> I don't see why Python programs would be more likely to generate long
> lines than programs in other languages.

Try this with the currently released version of emacs:

1. Start emacs with 'emacs -Q'
2. Type 'M-x ielm' then '(number-sequence 1 9999)'
3. Type 'M-x eshell' then 'number-sequence 1 9999 RET'
4. Type 'M-x shell' then 'python -c "print(list(range(9999)))" RET'
5. Type 'M-x run-python' then 'print(list(range(9999))) RET'

For me 1-3 print relatively quickly, 4 prints relatively slowly, and
_only_ 5 is so slow that I consider it non-functional. This bug report
is about issue 5 above.

Of course if you have a patch to make 4 faster as well that's great.
But 5 is the bug I'm reporting here, and I would really appreciate it
someone would either accept my suggestion for fixing it or provide an
alternative fix that does the job better.

Best,
Ista



>
> But yes, I'd really be happy to see some tentative patch along the lines
> I outlined above.
>
>
>         Stefan




This bug report was last modified 8 years and 316 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.