jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sridhar Raman" <sridhar.ra...@gmail.com>
Subject Re: Contrasting performances of skip on node iterator
Date Thu, 02 Oct 2008 13:02:57 GMT
Two things:
1) Does the performance of getNodes("*") improve with every subsequent
call?  I notice that, for the first call, it takes almost 6 seconds, but
after that, it takes .1 second.  Of course, there are no changes being made
to the repository.

2) Just like how it's possible to set a limit/offset for iterators returned
on queries, is it possible to do the same for getNodes()/getNodes("*")?

On Thu, Oct 2, 2008 at 5:36 PM, Jukka Zitting <jukka.zitting@gmail.com>wrote:

> Hi,
> On Thu, Oct 2, 2008 at 1:52 PM, Sridhar Raman <sridhar.raman@gmail.com>
> wrote:
> > Here's another curious thing that I noticed.  In the first case, I was
> using
> > node.getNodes() to get the iterator.  I tried node.getNodes("*"), and I
> > notice that the skip method now is almost instantaneous.  Is this
> expected?
> That's because getNodes("*") already traverses the list of all child
> nodes before returning an iterator over the collection of all matching
> nodes. The skip method is fast on the returned iterator just because
> all the hard work has already been done.
> The getNodes() method on the other hand tries to postpone the
> expensive operations as long as possible, which is why it'll return
> fast, but then the next() and skip() methods on the returned iterator
> are more expensive.
> BR,
> Jukka Zitting

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message