[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: |
Fri, 21 Mar 2014 06:25:59 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: lee <lee@yun.yagibdah.de>
>> Date: Thu, 20 Mar 2014 18:34:58 +0100
>>
>> 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.
>
> After you've read the directory, its entries, including "..", are in
> the cache, so (file-directory-p "..") should not need to hit the disk.
>
>> 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.
>
> Non-existing files are missing entries in their parent directories,
> which are files by themselves, and thus cached. So dealing with
> non-existing files just means reading their directory (from memory,
> not from disk) and noticing that a file by that name is not there.
That`s probably all true --- yet I think a simple string match may be
faster. And if the cache is small, without the check it might yet cause
file-lookups ...
--
Knowledge is volatile and fluid. Software is power.