From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Herman=2c_G=c3=a9za?= Newsgroups: gmane.emacs.help Subject: Re: Strange shell mode performance Date: Wed, 21 Oct 2020 12:27:33 +0200 Message-ID: References: <877drkmkqs.fsf@robertthorpeconsulting.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11048"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 Cc: help-gnu-emacs@gnu.org To: Robert Thorpe Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 21 12:28:10 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 1kVBLl-0002lA-LY for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 21 Oct 2020 12:28:09 +0200 Original-Received: from localhost ([::1]:56660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVBLk-00023K-Hk for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 21 Oct 2020 06:28:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVBLG-00022l-Ue for help-gnu-emacs@gnu.org; Wed, 21 Oct 2020 06:27:39 -0400 Original-Received: from mail-ej1-x642.google.com ([2a00:1450:4864:20::642]:35976) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kVBLF-00068v-4f for help-gnu-emacs@gnu.org; Wed, 21 Oct 2020 06:27:38 -0400 Original-Received: by mail-ej1-x642.google.com with SMTP id qp15so2446399ejb.3 for ; Wed, 21 Oct 2020 03:27:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=BZVAnPqGT+2Zpx2GWanqLR30NbXXEb67CNZ8SmW2Gpw=; b=VVdCT8fGaOiN2AejIJ0n3/SeUt0wXr3qxsZUPLCxR9ZCAA4e7OOy8fQvyGM4ZA8s0B TRo12ObT2+QC9JZ32K6TfB9tORWPoMz0WdTLoeCIBYWH+KI4QKkLgGECNlKQh8rjSj8n 4pCXV2JOGFV/5jI638nCS+HTMe1s/STli2WOMPk8LaBDjZqAmFriWjEyNVsEZw4l8foG kxVzjD6aVRkuA4t3mi95G05RIL8EhU794jXWvS52jGq8yvFvnoUsZM0Of2QZmoqQJWGf f23Ns33H2wk6OCXLm30k9hnkYV0lSBKKt9/8sjDJECLBgKZCsosImSLn5A5iRiUGEZls LQOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=BZVAnPqGT+2Zpx2GWanqLR30NbXXEb67CNZ8SmW2Gpw=; b=eigM8Odg6Nekp/g1OWiCKybV7KNkwHFib6gMukuE+6kIMQ5v3wUzlM2JbOObC8sTuK xYT9cDh0FEHFwjx7Jat+wplSumkS+jiHfI0iym7rN83SG3SG+zFExfj1CT9/eLIJuWa8 9zdWMHsO8yov4M0aR7Fnl6N0pug3IrKKe+tsDMN/oH0vPViMOr3xw5ggRjpXwlMxyOIM B5TWEkdbMtjxdvHxNI4am1NwaBfARw+UXhU7GOC6yJCHBvjiGhlNd3S/R4eg5WB6lMyg wH77xuIf/ZcfbjceYFr/yJrQp+r0znscgF8EvK6r16wIOS83+qluxPs5urv3Xzzg9dvW HrjQ== X-Gm-Message-State: AOAM532yz4VFP5mO3yuS5cHHFvKubKDnoeqOTWSbRSNYC2Pj9MGgOyoO ZwfggxOsD89KUKJ4flnDNvs= X-Google-Smtp-Source: ABdhPJwgoyKmBbuERxJN2bMDsHgB3C/T7hDLHrSohvDqUbq2OGh/T3sWPAgKH3DCGpmq/YBWMC1PVw== X-Received: by 2002:a17:906:513:: with SMTP id j19mr2767248eja.129.1603276055059; Wed, 21 Oct 2020 03:27:35 -0700 (PDT) Original-Received: from [192.168.8.4] (netacc-gpn-34-186-103.pool.telenor.hu. [37.234.186.103]) by smtp.gmail.com with ESMTPSA id dp1sm2109109ejc.74.2020.10.21.03.27.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Oct 2020 03:27:34 -0700 (PDT) In-Reply-To: <877drkmkqs.fsf@robertthorpeconsulting.com> Content-Language: sv-FI Received-SPF: pass client-ip=2a00:1450:4864:20::642; envelope-from=geza.herman@gmail.com; helo=mail-ej1-x642.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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:124614 Archived-At: The bug is caused by process-adaptive-read-buffering. I analyzed the issue. For my use case, I made shell ~60x faster by simple modifications (details: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44007). On 2020-10-21 03:27, Robert Thorpe wrote: > 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 anyway). > > 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éza writes: > >> Hi all, >> >> I'm experiencing strange shell (comint) mode performance. If I cat a 10 >> MB file, it takes 1:20 to cat it. Emacs uses only 30% cpu. But, if I >> press enter after I send the cat command, it speeds up, and it only >> takes 8 sec (emacs cpu usage goes up to 100%). >> >> Same thing: if I execute "seq 100000" in a small emacs window, it takes >> ~3 seconds. But, if I press enter after executing seq, it takes only 0.4 >> sec (this is not 100% reproducible, sometimes pressing enter doesn't >> 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 >> extra config (emacs -Q). >> >> Any ideas what causes this? Would it be possible to always have the >> better performance without needing to press enter? >> >> Thanks, >> Geza