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


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: ljell <laszlomail <at> protonmail.com>
Subject: bug#43016: closed (Re: bug#43016: replace-region-contents takes a
 lot of time when called from json-pretty-print-buffer)
Date: Tue, 25 Aug 2020 18:20:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 43016 <at> debbugs.gnu.org.

-- 
43016: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=43016
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: ljell <laszlomail <at> protonmail.com>, Eli Zaretskii <eliz <at> gnu.org>,
 Bruno Haible <bruno <at> clisp.org>, 43016-done <at> debbugs.gnu.org
Subject: Re: bug#43016: replace-region-contents takes a lot of time when
 called from json-pretty-print-buffer
Date: Tue, 25 Aug 2020 11:19:47 -0700
On 8/25/20 10:30 AM, Tassilo Horn wrote:

> Seems to work fine for me too with all three files of this report and
> the large one from bug#42931.  It seems like the early abort will now
> happen shortly after MAX-SECS bounds.

Thanks for checking; closing the Emacs bug report.

[Message part 3 (message/rfc822, inline)]
From: ljell <laszlomail <at> protonmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: replace-region-contents takes a lot of time when called from
 json-pretty-print-buffer
Date: Mon, 24 Aug 2020 08:25:14 +0000
[Message part 4 (text/plain, inline)]
I have a code which pretty prints data in json:

...
(with-temp-buffer
(insert data)
(json-pretty-print-buffer)
(write-file "data.json"))
...

This code runs for several minutes (I didn't time it, but it's about 1-2 minutes) with Emacs 27.1 It takes several seconds with Emacs 26. Data is about 1MB on disk in pretty printed elisp format.

I tried profiling with this result:

- progn 7486 98%
- json-pretty-print-buffer 7438 98%
- json-pretty-print 7438 98%
- replace-region-contents 7438 98%
+ #<compiled 0x3854909> 198 2%
+ insert 43 0%
+ write-file 5 0%

Apparently, replace-region-contents takes 98% of the CPU time.

Using Windows version from GNU ftp :

GNU Emacs 27.1 (build 1, x86_64-w64-mingw32) of 2020-08-12
[Message part 5 (text/html, inline)]

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.