jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: Problems with NodeIterator - iter.next() is better than iter.nextNode()
Date Fri, 30 Mar 2007 12:37:35 GMT
Hi,

On 3/30/07, Alexandre Martins <alexandremartins@gmail.com> wrote:
> The NodeIterator class has a method called nextNode(), using this is not
> necessary do a cast. However, using the next method (normal from Iterator) ,
> the results are so better (iteration time).
>
>  (Node)iter.Next: 453 ms
>  iter.NextNode(): 3552 ms
>
> Somebody knows why?

Did you do something like this:

    Node parent = ...;
    NodeIterator a = parent.getNodes();
    while (a.hasNext()) { a.nextNode(); }
    NodeIterator b = parent.getNodes();
    while (b.hasNext()) { b.next(); }

In such a case the second run will definitely be much faster since all
the nodes are already cached.

BR,

Jukka Zitting

Mime
View raw message