Subject: bug#42911: 28.0.50; write_region sometimes extremely very slow

From: Eli Zaretskii <[email-masked]>
Date: Tue, 25 Aug 2020 19:19:02 +0300

> From: Tino Calancha <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Tue, 25 Aug 2020 18:04:17 +0200
> 
> > Did you check that GC doesn't kick in when the "slow" saving happens?
> `benchmark-run` lets you know teh number of GC and the time used by them
> while running the form.  The reported slowliness was happening even
> without GC.
> I was curious if someone runnning opensuse Tumbleweed was seeing something similar.
> 
> I suspect this might be a problem of my OS (probably it was under heavy stress).
> Now I am in vacation, and the computer seems more relax (same like me).  I have also
> upgraded the OS and got a new kernel.
> 
> The following is data right now running this:
> emacs -Q /tmp/save-slow-buffer.txt
> ;; evaluate the following key binding:
> 
> (global-set-key (kbd "<f5>") (lambda () (interactive) (print
> (benchmark-run nil (save-buffer)) (current-buffer))))
> 
> ;; now push <f5> slowly several times
> ;; Still seems a bit slow sometimes (~0.1 s) but it is acceptable for my needs:

If it isn't GC, then my suggestion would be to run Emacs under 'perf'
and see what the profile tells us.