From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Thorpe Newsgroups: gmane.emacs.help Subject: Re: Strange shell mode performance Date: Wed, 21 Oct 2020 02:27:23 +0100 Message-ID: <877drkmkqs.fsf@robertthorpeconsulting.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20772"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Herman =?utf-8?Q?G=C3=A9za?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 21 03:28:37 2020 Return-path: Envelope-to: geh-help-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 1kV2vd-0005JI-6S for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 21 Oct 2020 03:28:37 +0200 Original-Received: from localhost ([::1]:51672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kV2vc-0001Ea-9L for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 20 Oct 2020 21:28:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47316) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kV2ut-0001EH-RH for help-gnu-emacs@gnu.org; Tue, 20 Oct 2020 21:27:52 -0400 Original-Received: from outbound-smtp21.blacknight.com ([81.17.249.41]:44200) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kV2up-0006r2-Hp for help-gnu-emacs@gnu.org; Tue, 20 Oct 2020 21:27:50 -0400 Original-Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp21.blacknight.com (Postfix) with ESMTPS id 8EEB8CCAF8 for ; Wed, 21 Oct 2020 02:27:43 +0100 (IST) Original-Received: (qmail 10506 invoked from network); 21 Oct 2020 01:27:43 -0000 Original-Received: from unknown (HELO rt-inspiron-3480) (rt@robertthorpeconsulting.com@[51.37.30.105]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 21 Oct 2020 01:27:43 -0000 In-Reply-To: (message from Herman, =?utf-8?Q?G=C3=A9za?= on Wed, 14 Oct 2020 12:49:06 +0200) Received-SPF: pass client-ip=81.17.249.41; envelope-from=rt@robertthorpeconsulting.com; helo=outbound-smtp21.blacknight.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/20 21:27:43 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:124606 Archived-At: I suspect that this is about memory allocation. I've noticed strange things like this before with large shell buffers. I don't think that pressing enter is really what makes the difference. I expect it's the memory that Emacs has allocated. When you have a small shell buffer you're usually reusing memory that has already been allocated to Emacs. That's because Emacs is constantly allocating and deallocating memory within it's own memory management. AFAIK it never actually gives memory back to the OS (modern OSes don't really need that an= yway). However, when the size of the shell buffer rises above the largest size that the Emacs process have ever been things change. Then new memory has to be allocated to Emacs. I may be wrong about this though, it was ages since I looked at the code. BR, Robert Thorpe Herman, G=C3=A9za writes: > Hi all, > > I'm experiencing strange shell (comint) mode performance. If I cat a 10=20 > MB file, it takes 1:20 to cat it. Emacs uses only 30% cpu. But, if I=20 > press enter after I send the cat command, it speeds up, and it only=20 > takes 8 sec (emacs cpu usage goes up to 100%). > > Same thing: if I execute "seq 100000" in a small emacs window, it takes=20 > ~3 seconds. But, if I press enter after executing seq, it takes only 0.4= =20 > sec (this is not 100% reproducible, sometimes pressing enter doesn't=20 > make a difference). > (I executed comint-clear-buffer before measurements) > > It happens with 26.3 and ~3-week-old master branch as well, without any=20 > extra config (emacs -Q). > > Any ideas what causes this? Would it be possible to always have the=20 > better performance without needing to press enter? > > Thanks, > Geza