Loader Cache improvements
Dirk Mueller
mueller at kde.org
Mon Jan 12 15:01:24 CET 2004
On Monday 12 January 2004 08:16, David Hyatt wrote:
> In case you're curious, I implemented the LRU-SP algorithm in the
> loader after reading this paper:
Thanks. Looking at it, it doesn't mention the uncachable hack, so I'm fairly
happy :-) It should also be obvious that this LRU-SP performs much better in
*ALL* cases than the uncachable hack.
However, now that you asked me to look at the algorithm ;-) I notice this
problem:
static LRUList* getLRUListFor(CachedObject* o)
{
int accessCount = o->accessCount();
int queueIndex;
if (accessCount == 0) {
queueIndex = 0;
} else {
int sizeLog = FastLog2(o->size());
queueIndex = sizeLog/o->accessCount() - 1;
if (queueIndex < 0)
queueIndex = 0;
if (queueIndex >= MAX_LRU_LISTS)
queueIndex = MAX_LRU_LISTS-1;
}
return &m_LRULists[queueIndex];
}
Technically, shouldn't accessCount == 0 case result in queueIndex=
MAX_LRU_LISTS-1 ?
Or are you trying to avoid the "object is deleted between requestImage() and
its first ref() " case ?
Hmm, thats probably it. though we handle this so far by never putting a
deref() between the requestXXX and the first ref(). As we only flush on
deref(), that should be fine.
hmm, I should add an assert there and see if it is ever triggered..
Dirk
More information about the Khtml-devel
mailing list