[Top][All Lists]

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

bug#122: 23.0.60; Slowdown in directory scanning over time.

From: Kenichi Handa
Subject: bug#122: 23.0.60; Slowdown in directory scanning over time.
Date: Wed, 17 Sep 2008 11:19:15 +0900
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/23.0.60 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

In article <address@hidden>, Stefan Monnier <address@hidden> writes:

> > I've just modified the current code to avoid calling
> > Fget_buffer_create when we alreay have
> > Vcode_conversion_reused_workbuf.  But, I think it doens't
> > influence the efficiency that much because
> > Fget_buffer_create doesn't create a new buffer if a buffer
> > of the specified name already exists.

> But the title-problem showed that having many buffers (like 200 or so)
> can cause this buffer-name-lookup to take a long time.  The worst part
> is that having 200 buffers is not particularly excessive: I regularly
> have Emacs session with a hundred buffers or so.  So we should avoid
> this lookup loop whenever necessary.

The slowness came from the inefficiency of
generate-new-buffer-name when there exist many buffers of
the same base name.  To generate the 201th buffer, it scans
the buffer list 200 times (comparing names 200*201/2 = 20100
times), and the following get-buffer-create scans it again.

As there usually exist a few buffers whose name start with a
space, I believe get-buffer is very fast for finding such a
buffer.  But, even if that is so, in genenral, I agree that
we should avoid unnecessary call.

Kenichi Handa

reply via email to

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