all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Thorpe <rt@robertthorpeconsulting.com>
To: "Herman Géza" <geza.herman@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Strange shell mode performance
Date: Wed, 21 Oct 2020 02:27:23 +0100	[thread overview]
Message-ID: <877drkmkqs.fsf@robertthorpeconsulting.com> (raw)
In-Reply-To: <e1a9c41d-3fd5-07f7-9282-c3529d610d1e@gmail.com> (message from Herman, Géza on Wed, 14 Oct 2020 12:49:06 +0200)

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 <geza.herman@gmail.com> 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



  parent reply	other threads:[~2020-10-21  1:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14 10:49 Strange shell mode performance Herman, Géza
2020-10-14 17:32 ` Stefan Monnier
2020-10-21  1:27 ` Robert Thorpe [this message]
2020-10-21 10:27   ` Herman, Géza

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=877drkmkqs.fsf@robertthorpeconsulting.com \
    --to=rt@robertthorpeconsulting.com \
    --cc=geza.herman@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.