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: Thu, 6 Jun 2024 17:09:18 -0700	[thread overview]
Message-ID: <4ae71801-51f4-629f-4212-eb4ed42759b8@gmail.com> (raw)
In-Reply-To: <CADwFkm=3OaY3U=0kocufdAKUUbHPKBUuftTR_Kor2=Goe7uvMQ@mail.gmail.com>

On 6/6/2024 4:14 PM, Stefan Kangas wrote:
> FWIW, I've experimented a bit on my machine, and I see the following
> using the command "time cat config.log" from an initially empty eshell
> buffer:
> 
> | eshell-buffered-print-size | secs       |       |
> |----------------------------+------------+-------|
> |                        256 | 1.922 secs |     1 |
> |                        512 | 1.413 secs |  0.74 |
> |                       1024 | 1.065 secs |  0.55 |
> |                       2048 | 0.996 secs |  0.52 |
> |                       4096 | 0.860 secs |  0.45 |
> |                       8192 | 0.835 secs |  0.43 |
> |                      16384 | 0.829 secs |  0.43 |
> 
> To me, these numbers seem to suggest that, at least on this system,
> there is a sweet spot around 4096, but 2048 admittedly does already get
> us most of the way there.  However, going above 8192 doesn't lead to any
> appreciable speedup.  This is on a fast M2 machine; it would be
> interesting to see some experiments on slower machines as well.
> 
> I'm assuming that we don't want to set it to some arbitrarily large
> number, but do we expect any adverse affects from choosing a slightly
> higher value?  If not, is there a case to be made for choosing 4096 as
> the default?

This is consistent with what I saw, but I thought it best to err on the 
side of smallness for the buffer size, just to ensure that we flush the 
buffer faster than the redisplay rate (defaulting to 40Hz), even on 
slower machines. Since the difference between 2048 and 4096 is small, I 
figured it wasn't too high a price to pay.

In your tests, just like mine, the difference between 1024 and 2048 is 
also small, but I opted for the larger 2048 because it produced a 
more-noticeable improvement when running `time ls -Al /usr/bin`.

That said, if we wanted to use a buffer size of 4096, I don't think that 
would cause any major issues. (At least on my system, when running an 
external command in Eshell, it writes 4095 bytes at a time, since that's 
how much data we get at once from the process filter. As far as I'm 
aware, it's been that way forever.)

On some level, I think any value between about 1024 and 4096 is probably 
somewhat arbitrary. They'd likely all be fine in most cases, and have 
much better performance than what we have today.





  reply	other threads:[~2024-06-07  0:09 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
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 [this message]
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=4ae71801-51f4-629f-4212-eb4ed42759b8@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.