emacs-devel
[Top][All Lists]
Advanced

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

Re: X performance suffers under emacs 21.1.1


From: Kim F. Storm
Subject: Re: X performance suffers under emacs 21.1.1
Date: 30 Nov 2001 15:51:29 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

address@hidden (Gerd Moellmann) writes:

> address@hidden (Kim F. Storm) writes:
> 
> > IMO, the image cache should have an upper bound to the number of
> > cached entries, and some form of functionality to clean up the cache
> > in case there are no (or very few) free entries.
> 
> Can you please explain why?  I tend to think that such a limit would
> rarely have the ``right'' value.
> 

To avoid a situation where the cache grows beyond any reasonable limit.
I don't know what the right limit is - but maybe 100 images
or 10 MB would be enough?  Still, it should only be a trigger for
when to try to clean out things from the cache.

> [...]
> 
> > can you say something about for how long an image must stay in the
> > cache for the display engine to work?
> 
> There's no requirement except that images don't get removed from under
> redisplay's feet, i.e. during a redisplay.
> 
> 

So in principle, the cache could be cleared after each redisplay.

It would be possible to make an adaptive algorithm where we put a
limit on the size of the cache and do something like this after
each redisplay:

        cache_expiration_time = 30 minutes
        while (size_of_cache > cache_size_limit) {
                for each cache element do {
                        if (element.last_used > cache_expiration_time) {
                                remove element from cache;
                        }
                }
                cache_expiration_time /= 2;
                if (cache_expiration_time < 1 minute)
                        break;
        }
        
Of course, the algorithm can be optimized to avoid extra loops through
the cache if there are not entries which is more than 1 minute old.
It can also use a flag which indicates whether the last redisplay
added any images to the cache - if not, the expiration can be postponed.

Also, the expiration can be delayed until emacs is idle, ie. redisplay
only sets a flag to indicate expiration is required...

But in any case, it might be interesting to know what images are
filling up the cache - maybe a view-image-cache-info function would be
handy ?

-- 
Kim F. Storm <address@hidden> http://www.cua.dk




reply via email to

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