lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Toke Eskildsen>
Subject Re: RAMDirectory doesn't win over FSDirectory all the time, why?
Date Tue, 07 Jun 2011 08:28:11 GMT
On Mon, 2011-06-06 at 15:29 +0200, zhoucheng2008 wrote:
> I read the lucene in action book and just tested the
> with the following uncommented:
> [...]Here is the output:
> RAMDirectory Time: 805 ms
> FSDirectory Time : 728 ms

This is the code, right?

The test is problematic as the same two tests run sequentially.

If you change 
  long ramTiming = timeIndexWriter(ramDir);
  long fsTiming = timeIndexWriter(fsDir);
  long fsTiming = timeIndexWriter(fsDir);
  long ramTiming = timeIndexWriter(ramDir); 
my guess is that RAMDirectory will be faster. For a better
comparison, perform each test in separate runs (make a test
class just for RAMDirectory and one just for FSDirectory,
then run them one at a time, each in its own JVM).

One big problem when comparing RAMDirectory to file-access
is caching. What you measure with a test might not be what
you see in production, as the production index might be
large compared to RAM available for file caching.

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

View raw message