Re: [Nautilus-list] Icon directory contents caching



On Sat, 2001-10-06 at 16:23, Alex Larsson wrote:
> On 6 Oct 2001, Yoann Vandoorselaere wrote:
> 
> > On Sat, 2001-10-06 at 04:49, Alex Larsson wrote:
> > 
> > Hi, 
> > 
> > here are some comment about the implementation.
> > 
> > [...]
> > 
> > You use an array in order to store icons informations. Using a
> > dynamically allocated array for this task seem overkill to me as you're
> > gonna use realloc() which take a lot of time, and so should be avoided
> > for obvious reasons.
> 
> realloc doesn't take lots of time. 

It depend. If the block already allocated cannot be extended, you endup
with another allocation + a copy. This is what I call slow, when you
could do far better using linked list.

> The time it takes is insignificant 
> compared to the disk accesses and syscalls that readdir() + opendir() 
> does.

I agree. But my point is that you can still do better easily using a
linked list.

> > Second, is that if you want to keep using this algorithm (which could
> > really be improved, it's linear currently), you should use linked list
> > as it seem to fit better with what you're currently trying to achieve.
> > 
> > Now, I would be a really good thing to use an hash table to store list
> > of icon informations. You would just use the icon filename to generate
> > the key.
> 
> I could modify it to use a hashtable instead of an array. That is a very 
> easy change. I dunno if it is worth it though. I'll try on monday.

Can you tell me the average number of file we'll have cached ?

-- 
Yoann Vandoorselaere
http://prelude.sourceforge.net





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