On 05/07/2011 09:20 AM, Vladimir Nadvornik wrote: > Hi, > > On St 4. května 2011, Omari Stephens wrote: >> Howdy, all >> >> I'm poking around with the marks code. Currently, marks are _really >> slow_ when you connect at least one mark to an image tag — when an image >> with no marks drops to zero refs, we lose track of what marks it may >> have, and on the next marks filtering op, we end up having to hit the >> XMP for every file in the directory. >> > > This analysis is not exactly right. > > 1. All files in current directory are hold in ViewFile->list so they can't > have zero refs. > > 2. When there is a connection between mark and keyword, the mark value is > no longer taken from FileData, but file_data_get_mark() calls > file_data_get_mark_func and uses it's result. The value in FileData is then > updated, but it is important only for keeping the last value after the > connection is switched off. > > 3. file_data_get_mark_func points to meta_data_get_keyword_mark which then > calls metadata_read_list(). It uses cached metadata when they are available > or it really reads them from file. > > So IMHO the problem appears the number of files in the directory is higher > than the number of files with cached metadata. Caching all metadata is quite > expensive (even 100KB per file), so I would fix this by implementing another > long-term cache for selected metadata entries (keywords) in > metadata_read_list().
Hmm. So the observation I made is that with the stock code, for all files _except_ for those with some marks set, fd->valid_marks is reset to 0 each time we enter file_data_get_mark. That automatically means that fd->marks is a cache miss and we hit file_data_get_mark_func as you mentioned. If I do a single unbalanced file_data_ref_fd(fd) after sticking a valid value into the fd->marks cache, then we get cache hits on fd->marks every time thereafter. So there's something that's causing the cached marks to get GCed which doesn't happen when I do a single extra ref increment. That said, I'll print out the actual refcount or something to try to figure out what's going on. Also, I wasn't aware that there was another metadata cache, I'll go poke at that. --xsdg ------------------------------------------------------------------------------ WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd _______________________________________________ Geeqie-devel mailing list Geeqie-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geeqie-devel