Subject: bug#43016: replace-region-contents takes a lot of time when called from json-pretty-print-buffer

From: Eli Zaretskii <[email-masked]>
Date: Mon, 24 Aug 2020 20:27:30 +0300

> From: Tassilo Horn <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,
> 	"[email-masked]" <[email-masked]>,
> 	Paul Eggert <[email-masked]>
> Date: Mon, 24 Aug 2020 19:14:50 +0200
> 
> So basically I'd say the problem is in gnulib's compareseq.  If it can't
> be fixed there, I see no other possibility than to stop using
> replace-buffer/region-contents in json.el (and wherever it might also be
> used).  That would be sad because except for the performance in some
> cases, it's very nice. :-(

Could we decide whether to use replace-* functions dynamically, based
on the size of the region/buffer being prettified?

Btw, there's another problem with compareseq, see bug#42931.  I guess
we need to add another criterion for early_abort, based on depth of
recursion?

Thanks.