Subject: bug#44983: Truncate long lines of grep output

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 30 Apr 2022 11:24:29 +0200

Eli Zaretskii <[email-masked]> writes:

>> > If that doesn't help either, I suggest to profile the code, because it
>> > could be the slow display is due to something else.
>> 
>> Hm, yes...  even if I disable font-lock-mode, it's still slow.
>
> Then I think a profile should tell something interesting.

Turns out to be font lock anyway:

        9152  88% - redisplay_internal (C function)
        9148  88%  - jit-lock-function
        9148  88%   - jit-lock-fontify-now
        9148  88%    - jit-lock--run-functions
        9144  87%     - run-hook-wrapped
        9144  87%      - #<compiled -0x1568eefe49e247c3>
        9144  87%       - font-lock-fontify-region
        9144  87%        - font-lock-default-fontify-region
        9144  87%           font-lock-fontify-keywords-region

Apparently disabling font-lock-mode in the *grep* buffer wasn't
sufficient to make it go away for some reason or other.  Disabling
global-font-lock-mode makes the problem go away.  And using invisible
text instead of a display property makes no difference -- font-lock
seems to really want to do font locking on ever-growing lines that are
inserted into the buffer by the process.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no