Subject: bug#51006: 28.0.60; Slowness while navigating in inferior-python-mode

From: Eli Zaretskii <[email-masked]>
Date: Mon, 04 Oct 2021 16:24:33 +0300

> From: Simen Heggestøyl <[email-masked]>
> Date: Mon, 04 Oct 2021 14:54:24 +0200
> 
> Here's the report from a quick profiling I did in Emacs 28:
> 
> 13447  94% - python-shell-font-lock-post-command-hook
> 13444  94%  - font-lock-ensure
> 13444  94%   - #<compiled -0x19f3968dc99b6307>
> 13444  94%    - font-lock-fontify-region
> 13444  94%     - font-lock-default-fontify-region
> 13420  94%      - font-lock-fontify-syntactically-region
> 13420  94%       - python-font-lock-syntactic-face-function
> 13412  94%        - python-info-docstring-p
> 13396  94%         + python-nav-beginning-of-statement
>     4   0%         + python-info-assignment-statement-p
>     8   0%      + font-lock-fontify-keywords-region
>     3   0%  + font-lock-mode
>   529   3% + ...
>   183   1% + command-execute

Please repeat the profiling experiment, but after loading python.el
(NOT python.elc).  This should produce a more detailed profile that
would pinpoint the culprit more accurately.  Based on skimming the
source code, my first suspect is syntax-ppss, but that could be a bad
guess.

Thanks.