GNU bug report logs - #43016
replace-region-contents takes a lot of time when called from json-pretty-print-buffer

Previous Next

Package: emacs;

Reported by: ljell <laszlomail <at> protonmail.com>

Date: Mon, 24 Aug 2020 09:26:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #32 received at 43016 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: laszlomail <at> protonmail.com, 43016 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu
Subject: Re: bug#43016: replace-region-contents takes a lot of time when
 called from json-pretty-print-buffer
Date: Mon, 24 Aug 2020 22:36:03 +0300
> From: Tassilo Horn <tsdh <at> gnu.org>
> Cc: laszlomail <at> protonmail.com,  43016 <at> debbugs.gnu.org,  eggert <at> cs.ucla.edu
> Date: Mon, 24 Aug 2020 21:15:42 +0200
> 
> ljell is right, it seems to have to do with the non-ASCII characters.
> In my sample.json.gz from above, I've just replaced every "e" with an
> "Ê" (except in true/false literals).  When I prettify that, it aborts
> early (fast) just after 449 early_abort_tests.
> 
> So just replacing "e" with an "Ê" changed "compares in time with 300.000
> early_abort_tests" to "doesn't compare in time and makes only 449
> early_abort_tests in that time".  The only difference to ljell's test
> file is that with mine, there doesn't seem to be a big gap between the
> last early_abort_test returning false and the one returning true.

I guess it's somehow related to the fact that buffer_chars_equal is
optimized for pure-ASCII buffers, see how we compute a_unibyte and
b_unibyte members of the context struct.




This bug report was last modified 4 years and 355 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.