emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple optimization for read_avail_input()


From: Kim F. Storm
Subject: Re: Simple optimization for read_avail_input()
Date: 18 Feb 2004 00:51:29 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Dmitry Antipov <address@hidden> 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 <address@hidden> http://www.cua.dk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]