cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Gritsenko" <>
Subject RE: Speedup *DirectoryGenerator (e.g. ImageDirectoryGenerator et al)...
Date Fri, 14 Jun 2002 16:17:37 GMT
> From: Per Kreipke []
> Wouldn't it be nice if the second time you requested the image info,
it was
> as fast as the DirectoryGenerator?
> Suggestions:

*DirectoryGenerators should be refactored so we have the only
DirectoryGenerator with pluggable 'processors' of different file types.
This way, you will be able to generate listings of different files of
type in one directory.

> - having getSize() call getFileType() and then getJpegSize() or
> getGifSize(), introduces nice modularity but sacrifices speed. Each
> in that sequence calls (that's two calls total):
>   new BufferedInputStream(new FileInputStream(file));
> Instead, instantiate the BufferedInputStream in getSize() and pass it
to the
> other functions. Or move the work from getFileType() and get*Size()
back in
> to getSize().

Instantiate one instance of RandomAccessFile and pass it to 'processor'.

> - more importantly, caching the information from getSize() plus
> 'lastModified' in an internal hash table with the file's URL as key
> remove the need to do the expensive work each time. If the file hasn't
> changed, then it's size (or MP3 info) hasn't either.

Cache key should be directory name plus settings, such as depth and

Cache validity should be TimestampCacheValidity (FileTimeStampValidity
in Cocoon 2.1) of all files selected by given depth/masks in this

> Unfortunately, I don't know Cocoon well enough to understand if
> are global instances (so that all requests will share the hash table)
> whether it exists per pipeline, per sitemap, etc. My point: I'm not
sure how
> to implement the cached info correctly.

Implement generateKey and generateValidity methods.


> I would love to do this work and send in the patch myself, and I'll
> to do so when I have the latest C2 source installed here. Unless
> desparate does it first :-)
> Per

To unsubscribe, e-mail:
For additional commands, email:

View raw message