lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Spencer, Dave" <d...@lumos.com>
Subject Converting a Directory to a RAMDirectory
Date Thu, 10 Oct 2002 19:17:28 GMT

A few months ago I suggested adding a utility 
that converts a Directory to a RAMDirectory - useful if
the index fits into RAM & are you're performing a series of expensive
searches on the index. It seems to have no additional startup cost
(surprising) and reduces execution time approx 20% (seems to be
reasonable).
I may have missed this or an equivalent utility being in the source base
but looked
at rc5 and didn't see it.

So I'm "reposting" this info & putting up a web page so this can
be reused & found by, um, searchers.

The utility drops in easy to existing code.
You replace a line like this:
    searcher = new IndexSearcher( indexName);
with
    searcher = new IndexSearcher( Rammer.convert( indexName));

And that's it - approx reduction of 20% of runtime in some tests.
For 2 experimental apps that do extensive term analysis (freq of pairs
of terms)
the time reductions are:
    app 1: 45sec to 35sec
    app 2: 22sec to 18sec

This is just by making a 1 line change.


I've attached the file here and written it up a bit 
on the web:

http://www.tropo.com/techno/java/lucene/rammer.html

I'm not an approved code contributor and ask that those who are consider
adding this to the base - could be a ctr to RAMDirectory or a method in
Directory of FSDirectory or a separate utility.

Mime
View raw message