all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Stefan Kangas <stefankangas@gmail.com>, 71355@debbugs.gnu.org
Subject: bug#71355: 30.0.50; [PATCH] Improve performance of buffered output in Eshell
Date: Tue, 4 Jun 2024 18:55:00 -0700	[thread overview]
Message-ID: <a63a682c-9182-29db-6083-59777dc3a912@gmail.com> (raw)
In-Reply-To: <CADwFkmn9QsJhr5oz++sfxih=XP4Ruiz8jUd1ovvnbfxJeukycw@mail.gmail.com>

On 6/4/2024 2:52 PM, Stefan Kangas wrote:
> Nice, thanks for working on this.  Your patch makes sense to me at first
> glance, but I didn't test it.  The performance improvement definitely
> seems highly worthwhile based on your measurements.

If anyone has time to test, I'd be interested to see if the results are 
similarly good on other platforms (I'm testing on x86_64 GNU/Linux), but 
I imagine they're comparable. The main areas of improvement are:

1. Batching output into larger chunks reduces the constant-time 
overheads associated with each write to the screen.

2. Scanning for control characters in output is much faster thanks to 
're-search-forward'.

3. The above improvements made it possible to add periodic redisplays, 
which eat into the perf improvements. I mitigated this by throttling the 
redisplay to 40Hz (the slowest value I found where the throttling isn't 
obvious).

> Bonus points for adding tests, as always.

I wrote some tests for the control character fix, since my changes to 
that function were nontrivial. I'll see if I can think of a few others, 
though I'm partly relying on the now-fairly-extensive Eshell test suite 
to catch any mistakes.

>> +(defcustom eshell-buffered-print-size 2048
>> +  "The size of the print queue in characters, for doing buffered printing.
>>   This is basically a speed enhancement, to avoid blocking the Lisp code
>>   from executing while Emacs is redisplaying."
> 
> How did you decide on this value?

Basically, I tried a few different command invocations that normally 
take a while (the main ones being "cat config.log" and "ls -Al 
/usr/bin") and scaled up the value by factors of two until I stopped 
seeing any major perf improvements. (Larger values are faster still, but 
not by a whole lot.)

> Could the docstring be expanded to explain what a user can expect to
> happen if they increase or decrease this value?

Sure, that makes sense. Essentially, smaller values will be slower, but 
may update faster (subject to the redisplay throttling), whereas larger 
values are the opposite.





  reply	other threads:[~2024-06-05  1:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04  5:36 bug#71355: 30.0.50; [PATCH] Improve performance of buffered output in Eshell Jim Porter
2024-06-04 21:52 ` Stefan Kangas
2024-06-05  1:55   ` Jim Porter [this message]
2024-06-05  3:50     ` Jim Porter
2024-06-05 12:06       ` Eli Zaretskii
2024-06-05 16:42         ` Jim Porter
2024-06-05 16:51           ` Eli Zaretskii
2024-06-05 17:35             ` Jim Porter
2024-06-05 17:57               ` Eli Zaretskii
2024-06-05 18:47                 ` Jim Porter
2024-06-05 18:58                   ` Eli Zaretskii
2024-06-05 20:07                     ` Jim Porter
2024-06-06  4:43                       ` Eli Zaretskii
2024-06-06 18:02                         ` Jim Porter
2024-06-08  4:25                           ` Jim Porter
2024-06-08  7:33                             ` Stefan Kangas
2024-06-08 19:43                               ` Jim Porter
2024-06-06  9:20     ` Stefan Kangas
2024-06-06 18:04       ` Jim Porter
2024-06-06 23:14     ` Stefan Kangas
2024-06-07  0:09       ` Jim Porter
2024-06-07  8:51         ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a63a682c-9182-29db-6083-59777dc3a912@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=71355@debbugs.gnu.org \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.