Subject: bug#49127: Performance degradation in encode_coding_object

From: Eli Zaretskii <[email-masked]>
Date: Mon, 16 Aug 2021 21:50:03 +0300

> From: Mattias Engdegård <[email-masked]>
> Date: Mon, 16 Aug 2021 20:06:32 +0200
> Cc: [email-masked], [email-masked]
> 
> > Yes.  Why do you think this loop is broken?
> 
> Because unless I misunderstood the code entirely, the current buffer has nothing to do with the operation at hand.

It does, if both src_object and dst_object are the same (current)
buffer.

> It's easy to reproduce the original problem: run Emacs in a terminal and make a buffer with many markers. See how the text displays slower with more markers. I've attached a short example; try (make-test-buffer 1000).

How can we be sure this reproduces the original issue?  The original
issue was reported from a real-life use case, not from a toy program.

> The attached patch fixes this problem.

Thanks, but this is not the whole story with that problem in
encode_coding_object.