unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: emacs-devel@gnu.org
Subject: Re: Simple optimization for read_avail_input()
Date: 18 Feb 2004 00:51:29 +0100	[thread overview]
Message-ID: <m3vfm5p8n2.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <401A7EFE.8030509@mail.ru>

Dmitry Antipov <dmitry.antipov@mail.ru> writes:

> Hello,
> 
> this is a top of gprof output for Emacs CVS snapshot. It was being compiled with
> '-O0 -ftest-coverage -g -pg -fprofile-arcs', started and finished with C-x C-c
> immediately:
> 
> Flat profile:
> 
> Each sample counts as 0.01 seconds.
>   %   cumulative   self              self     total           time
>       seconds   seconds    calls  ms/call  ms/call  name    12.12
>       0.04     0.04     2464     0.02     0.02  ccl_driver
>  12.12      0.08     0.04      546     0.07     0.07  read_avail_input
>   9.09      0.11     0.03    23731     0.00     0.00  read1
>   9.09      0.14     0.03     4452     0.01     0.01  mark_object
>   6.06      0.16     0.02   289315     0.00     0.00  readchar
>   6.06      0.18     0.02     8335     0.00     0.00  Fbyte_code
>   6.06      0.20     0.02      743     0.03     0.03  Fassoc
>   3.03      0.21     0.01   136877     0.00     0.00  translate_char
> 
> It's clear here that very simple function read_avail_input() wastes a lot of
> CPU time. IMHO this is because it wants to zero large 'struct input_event buf'
> (which is KBD_BUFFER_SIZE (4096, except old MacOSs) * sizeof (struct input_event)
> (44 bytes on 32-bit systems)) every time. But we can clear all 'buf' only once
> and clear only used slots next time. The following patch illustrates this idea:

Hi Dmitry,

Your patch was installed in CVS yesterday, but it had some problems,
so I reworked it quite a bit.

I don't know if the intended effect on read_avail_input is still
present with my changes, so I would ask you to redo your measurements
to see if my changes are ok.  Can you do that?

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

  parent reply	other threads:[~2004-02-17 23:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-30 15:57 Simple optimization for read_avail_input() Dmitry Antipov
2004-02-03 14:17 ` Kim F. Storm
2004-02-17 23:51 ` Kim F. Storm [this message]
2004-02-20  0:31   ` Kim F. Storm
     [not found] <E1Ap8aH-000LqG-00.dmitry-antipov-mail-ru@f7.mail.ru>
2004-02-07  0:12 ` Kim F. Storm

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3vfm5p8n2.fsf@kfs-l.imdomain.dk \
    --to=storm@cua.dk \
    --cc=emacs-devel@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).