unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43016: replace-region-contents takes a lot of time when called from json-pretty-print-buffer
@ 2020-08-24  8:25 ljell via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-08-24 10:37 ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: ljell via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-08-24  8:25 UTC (permalink / raw)
  To: 43016

[-- Attachment #1: Type: text/plain, Size: 719 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3216 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-08-25 18:26 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-24  8:25 bug#43016: replace-region-contents takes a lot of time when called from json-pretty-print-buffer ljell via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-24 10:37 ` Eli Zaretskii
2020-08-24 12:13   ` ljell via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-24 12:29     ` ljell via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-24 17:14     ` Tassilo Horn
2020-08-24 17:21       ` Lars Ingebrigtsen
2020-08-24 17:25         ` Philipp Stephani
2020-08-24 17:27       ` Eli Zaretskii
2020-08-24 19:15         ` Tassilo Horn
2020-08-24 19:36           ` Eli Zaretskii
2020-08-24 23:35       ` Paul Eggert
2020-08-25  6:10         ` Eli Zaretskii
2020-08-25 18:26           ` Paul Eggert
2020-08-25 17:30         ` Tassilo Horn
2020-08-25 18:19           ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).