Subject: bug#21077: 24.5; Slow printing in inferior python buffer with python-shell-enable-font-lock

From: Wolfgang Jenkner <[email-masked]>
Date: Sat, 01 Aug 2015 14:36:23 +0200

On Fri, Jul 31 2015, Ista Zahn wrote:

> 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.

I tested this with the current (bdd370b) vanilla emacs -Q master and
also a slightly older (78c3e14, not quite vanilla) version and I find
that 5 takes about 20 seconds while 4 takes about 30 seconds to print
the whole list (and the next prompt).  So, the reason for the behaviour
you reported (and Eli confirmed) might be elsewhere than in
font-locking?

I compiled emacs with

./configure --prefix=/usr/opt --with-x --with-x-toolkit=no --without-rsvg --without-cairo --without-gsettings --with-file-notification=no --without-compress-install

and the beginning of the python buffer is

Python 2.7.10 (default, Jul  4 2015, 12:57:42) 
[GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] on freebsd10
Type "help", "copyright", "credits" or "license" for more information.
>>> python.el: readline is available
>>> python.el: sent setup code
>>> print(list(range(9999)))

I've also a ~/.pythonrc.py which contains

import rlcompleter, readline
readline.parse_and_bind('tab: complete')