help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: iterating over a list while removing elements


From: lee
Subject: Re: iterating over a list while removing elements
Date: Thu, 20 Mar 2014 18:34:58 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Joost Kremers <joost.m.kremers@gmail.com> writes:

> Note, BTW, that file-directory-p returns t for "." and "..". It seems to
> me that the only two names that directory-files could return that you
> really want to exclude are those two,[1] so there's no need for
> multisearch-directory-ref-p, I think. (Or is there?)

The idea is that (file-directory-p "..") may cause a file look-up which
can be avoided by string-matching.  String-matching is some magnitudes
faster than file look-ups.

When I try multisearch with with a source file from a somewhat large
application that has a bunch of #includes, it takes a couple (like 15 or
so) seconds to create the list of files, and it creates 123 additional
buffers.  When you look at the source of multisearch[1], you`ll see that
there can be a huge amount of look-ups, many of them on non-existing
files.

How does the disk cache deal with non-existing files?  The
meta-information is probably in the cache (more or less), yet there can
be no information for non-existing files.  Creating the list of files is
actually what takes most of the time.  Visiting them is really fast;
searching doesn`t take long, either.


[1]: https://github.com/lee-/emacs/tree/master/multisearch

> [1] Files can have dots in their names, so what do you want to do with a
> file whose name ends in a dot? Or two? Unlikely, for sure, but not
> impossible.

Hm.  I haven`t considered this possibility ...  I`ll have to change the
regexps used in `multisearch-directory-ref-p' ...

Hmmmm ... I`m testing this again, and there seems to be a bug
somewhere.  I`ll fix that tomorrow or so ...


-- 
Knowledge is volatile and fluid.  Software is power.



reply via email to

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