lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: computing size() in frequently used methods
Date Tue, 26 Nov 2002 16:26:51 GMT
Of course :)
using -server option and not using it will also give you different
results.

Otis

--- Julien Nioche <Julien.Nioche@lingway.com> wrote:
> Maybe there's an optimization made by the java compilator... (or at
> execution time?)
> 
> 
> ----- Original Message -----
> From: "Otis Gospodnetic" <otis_gospodnetic@yahoo.com>
> To: "Lucene Developers List" <lucene-dev@jakarta.apache.org>
> Sent: Tuesday, November 26, 2002 6:52 AM
> Subject: Re: computing size() in frequently used methods
> 
> 
> > Finny that you say that, I just wanted to measure if what you are
> > suggesting has a significant impact on performance in general, not
> > for/because of Lucene.  It looks like it does not.
> > Attached is a class with a bad name (was used for something else
> > originally), but that will run a few things of this nature and
> print
> > out the timings.  Not a good way to benchmark, but I think it gives
> an
> > idea.
> >
> > Otis
> >
> >
> > --- Julien Nioche <Julien.Nioche@lingway.com> wrote:
> > > Hello,
> > >
> > > In the code of BooleanQuery and PhraseQuery loops are made using
> a
> > > size()
> > > method to check the bound. Since the methods of these classes are
> > > used very
> > > often, it could be useful to change the code in order to compute
> the
> > > size of
> > > the object only once, store it in an integer and check the bound
> on
> > > that
> > > integer.
> > >
> > > For example, the method sumOfSquaredWeights of the class
> BooleanQuery
> > > currently use the following :
> > >
> > >     for (int i = 0 ; i < clauses.size(); i++) {
> > >     ...
> > >     }
> > >
> > > which could be replaced by :
> > >
> > >  int clausenumber =  clauses.size();
> > >
> > >  for (int i = 0 ; i < clausenumber; i++)
> > >  {...}
> > >
> > >
> > > This kind of modification could be done in almost all the methods
> of
> > > the
> > > classes BooleanQuery and PhraseQuery, providing a small 
> optimization
> > > (I did
> > > not mesure it - but even small optimizations can be useful).
> > >
> > > Supposing that the size of the clauses or terms Vectors is not
> likely
> > > to
> > > change during the execution of these methods, this kind of change
> > > must be
> > > pretty harmless...
> > >
> > > Any opinion on that? Could it have a side effect?
> > >
> > >
> > > Julien Nioche
> > > www.lingway.com
> > >
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail:
> > > <mailto:lucene-dev-help@jakarta.apache.org>
> > >
> >
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> > http://mailplus.yahoo.com
> 
> 
>
----------------------------------------------------------------------------
> ----
> 
> 
> > --
> > To unsubscribe, e-mail:
> <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:lucene-dev-help@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:lucene-dev-help@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message