Ya you are correct. My idea will not work when there are lots of documents
in the index and also there are lots of hits for that page.
I am going with you.... :-)

Thanx...

On 6/29/06, James Pine <[EMAIL PROTECTED]> wrote:

Hey,

I'm not a performance guru, but it seems to me that if
you've got millions of results coming back then you
probably don't want to call ArrayList.add() each time,
as it will have to grow itself a bunch of times. Also,
even ints take up space in memory, so if you only need
20 of them, then storing millions is pretty wasteful.
As Paul suggested, using an int[] would be better, and
pretty easy since you know the size it needs to be in
advance i.e. resultsPerPage. If you're worried about
the conditional taking up cpu cycles you could use the
ternay operator which I believe is slightly more
efficient.

JAMES

--- "heritrix.lucene" <[EMAIL PROTECTED]>
wrote:

> This will break performance. It is better to first
> collect all the document
> > numbers (code without the proper declarations):
> >
> > public void collect(int id, float score) {
> >      if(docCount >= startDoc && docCount < endDoc)
> {
> >          docNrs.add(id); // or use int[] docNrs
> when possible.
> >   ....
>
>
> Why
> public void collect(int id, float score) {
>      if(docCount >= startDoc && docCount < endDoc) {
> is requiered.
>
> i think the bertter thing is
> public void collect(int id, float score) {
>     docNrs.add(id); // or use int[] docNrs when
> possible.
> because anyhow the collect metod will be called
> total number of matched
> documents times.
> why should we introfuce one more condition....
>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to