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

From: Philipp Stephani <[email-masked]>
Date: Mon, 24 Aug 2020 19:25:53 +0200

Am Mo., 24. Aug. 2020 um 19:22 Uhr schrieb Lars Ingebrigtsen <[email-masked]>:
>
> Tassilo Horn <[email-masked]> writes:
>
> > That would be sad because except for the performance in some
> > cases, it's very nice. :-(
>
> It is indeed very nice.  My guess is that most of the usages of the
> function is for shortish JSON structures.  Perhaps we could just
> introduce an arbitrary switchover between using replace-region-contents
> and plain replacing -- like a hundred K or something?
>

That's basically what the MAX-SECS and MAX-COST parameters are
supposed to do. We should definitely fix compareseq so that it takes
these costs into account more strictly (e.g. checking at least once
per million iterations or so).