[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CVS directories in completion-ignored-extensions
From: |
Kim F. Storm |
Subject: |
Re: CVS directories in completion-ignored-extensions |
Date: |
Wed, 19 Jan 2005 16:52:28 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>> To me it seems like the regexp cache could be improved by
>> keeping a usage counter and a lru timestamp so frequently
>> used regexps could be kept in the cache -- and the cache
>> could grow dynamically to always hold the most frequently
>> used regexps [with some hard upper limit of course].
>
> A cheap way to approximate something like that is to keep a `hit' flag
> indicating whether this cache entry has ever been re-used. Upon GC remove
> all entries for which `hit' is false and reset all `hit' flags to false.
And just reuse entries in the current LRC (least recently compiled)
way if we reach the hard limit.
>
> I.e. only those entries that have been reused since the last GC survive.
>
>> E.g. if I have a large number of regexps to split mail in gnus,
>> it would be nice to keep all of those in the cache.
>
> But of course a larger cache means slower lookup.
We can optimize that quite a bit, e.g. by hashing on SCHARS (pattern).
We could also optimize this test:
if (SCHARS (cp->regexp) == SCHARS (pattern)
&& STRING_MULTIBYTE (cp->regexp) == STRING_MULTIBYTE (pattern)
&& !NILP (Fstring_equal (cp->regexp, pattern))
...
with this test:
if ((EQ (cp->regexp, pattern)
|| (SCHARS (cp->regexp) == SCHARS (pattern)
&& STRING_MULTIBYTE (cp->regexp) == STRING_MULTIBYTE (pattern)
&& !NILP (Fstring_equal (cp->regexp, pattern))))
...
--
Kim F. Storm <address@hidden> http://www.cua.dk