From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#71355: 30.0.50; [PATCH] Improve performance of buffered output in Eshell Date: Thu, 6 Jun 2024 17:09:18 -0700 Message-ID: <4ae71801-51f4-629f-4212-eb4ed42759b8@gmail.com> References: <22b0dc8f-11dc-5fd2-c75d-88c17580d28d@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21733"; mail-complaints-to="usenet@ciao.gmane.io" To: Stefan Kangas , 71355@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 07 02:11:24 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sFNCW-0005UO-F2 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 07 Jun 2024 02:11:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFNBx-0005mf-DY; Thu, 06 Jun 2024 20:10:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFNBv-0005lh-Qz for bug-gnu-emacs@gnu.org; Thu, 06 Jun 2024 20:10:47 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sFNBv-000527-Jy for bug-gnu-emacs@gnu.org; Thu, 06 Jun 2024 20:10:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sFNCA-0007F6-4l for bug-gnu-emacs@gnu.org; Thu, 06 Jun 2024 20:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Jun 2024 00:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71355 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 71355-submit@debbugs.gnu.org id=B71355.171771904227776 (code B ref 71355); Fri, 07 Jun 2024 00:11:02 +0000 Original-Received: (at 71355) by debbugs.gnu.org; 7 Jun 2024 00:10:42 +0000 Original-Received: from localhost ([127.0.0.1]:54054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFNBp-0007Du-WC for submit@debbugs.gnu.org; Thu, 06 Jun 2024 20:10:42 -0400 Original-Received: from mail-oo1-f49.google.com ([209.85.161.49]:47193) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFNBo-0007DQ-NK for 71355@debbugs.gnu.org; Thu, 06 Jun 2024 20:10:41 -0400 Original-Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5ba69e446f4so634348eaf.2 for <71355@debbugs.gnu.org>; Thu, 06 Jun 2024 17:10:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717718960; x=1718323760; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=8rVaQEcDW5oJ0z3cugTyct7KGmPRYAD5LXy3qI7ECoI=; b=CUd6j/4fC98rKGmnDdLgpOge/bTCrc2ohogHqS/+y5PC9dwZFY4Qo1WatneucChuuy EtPTXzFL2QZ/6P/JBsAVsT5njGEfcXNMqufvd8UlIHh1gKVPaPS2mxIWurMm/hkHGI92 ptxwPLb9V5fYZ8kGr7jkVr+ilmhLAvdRIvXkVfvCIwIctMLCuSrH3HnuDB0X9bzBiJ73 Bk+/45dq1sw5yG4dgcOFPghYxyhnw6hOXPaAsdoQdUwRsiaiD/wUTlgdPZILRa4c61zg XBzzgAWADLHFK69Hxxrg7jpTrLvw1Ld8YLhfk1GQwjmerby5v6hfWY+p9En38vVY1Ol9 Xdug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717718960; x=1718323760; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8rVaQEcDW5oJ0z3cugTyct7KGmPRYAD5LXy3qI7ECoI=; b=APr/CRyrVkBeABapvM8mpK8yeJ1xFHTSocYvdGqpEFZ6hDadQOaaRzTHJcMbSxdH0W QpaNxdCpkjm9Ybv/nW5yAk8IjhBVjsD6IQO/lwdCtHYU8wC721o5JrLnykDGT4xVtcAi 7XNpBvcaZUQFHWI43LipuVtb1qclG92CtYhEcBs+kSN3FCC9038wWfdje7RVHMxIDBk8 QEBntvzaehfGNPQoR0hI/VRmyTGI4zV2mBRZ33vWGhNQ+rSimc8P+9CxFpQG9K7Cjrhz ezyUVa1FBI/VZN+zPaYKP9DdUZ+563C95KNAPRfwO/iDQgNyFipubHxbeE9iJvpaWHgy fB5w== X-Forwarded-Encrypted: i=1; AJvYcCVeGxwWvpDOw4Rbhi7JGAX2mr3RxD9ct6z6DdZbp9m1JyOWV7Scw1m/u7wI7l/fNWsqIdvNgFQRB9JXEiBQEfsnbvE22d4= X-Gm-Message-State: AOJu0YwmXSptyLuhepuB+GY68cJnNrW0h8B6fb8IG1TDq8q2a6pTkJu1 g6eXepx5IWgeFWlSNKt+cH+PJrX7iYbTXHJHTrm2kIptu08TPGm9 X-Google-Smtp-Source: AGHT+IFAh8E5rkDaoIdwGv6NnWzVoiV6wQo1BVWnl7KW2KEIdxKp9N8JqAfQuUogTayS+ZHp240GDw== X-Received: by 2002:a05:6358:7e99:b0:19f:339:7f45 with SMTP id e5c5f4694b2df-19f1fd01c24mr148758255d.4.1717718959694; Thu, 06 Jun 2024 17:09:19 -0700 (PDT) Original-Received: from [192.168.1.2] (syn-023-240-098-037.res.spectrum.com. [23.240.98.37]) by smtp.googlemail.com with ESMTPSA id 41be03b00d2f7-6de21788251sm1680136a12.30.2024.06.06.17.09.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Jun 2024 17:09:19 -0700 (PDT) Content-Language: en-US In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:286726 Archived-At: 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.