lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <erickerick...@gmail.com>
Subject unit test speed for TestCustomScoreQuery
Date Thu, 29 Oct 2009 19:10:07 GMT
OK, I'm actually getting of my duff and trying to do something. And I'm off
today feeling ill, so I have a bit of time. So the rational place to start
is to get all the code and run the unit tests, and I've even got them
running in IntelliJ as well as the ant task. Will wonders never cease.

The unit tests in TestCustomScoreQuery take on the order of 80 seconds on my
machine. Before I go off the deep end I wanted to run what I've found past
y'all to see if it makes sense.

Virtually all the time is taken up in the method logResult on the call to
QueryUtils.check(q, s). But the logResult method is called from
verifyResults method in a loop like:

for (Iterator it = h1.keySet().iterator(); it.hasNext();) {
      call logResult for 5 different queries.
}
But the queries don't change that I can see...

Why couldn't we just call QueryUtils.check once for each of the 5 queries
outside the for loop? Doing so reduces the time it takes for the test from
~80 seconds to 9 seconds.

If there're no objections, I'll make a patch. Which folks will probably have
to be patient with me since it'll be the first one I've produced for this
project.....

While I'm at it, what are we thinking about using JUnit4? Looking *briefly*
at the code, this actually seems like it'd be difficult. We'd have to deal
with the LuceneTestCase superclass...

Best
Erick

Mime
View raw message