jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Guggisberg <stefan.guggisb...@gmail.com>
Subject Re: svn commit: r1309458 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
Date Thu, 05 Apr 2012 07:43:23 GMT
On Thu, Apr 5, 2012 at 9:00 AM, Jukka Zitting <jukka.zitting@gmail.com> wrote:
> Hi,
>
> On Wed, Apr 4, 2012 at 5:36 PM,  <stefan@apache.org> wrote:
>> optimized getChildNode
>> [...]
>>         if (child == null && childNodeCount > MAX_CHILD_NODE_NAMES)
{
>>             String childPath = getChildPath(name);
>> -            try {
>> -                kernel.getNodes(childPath, revision, 0, 0, 0, null);
>> +            if (kernel.nodeExists(childPath, revision)) {
>>                 child = new KernelNodeState(kernel, childPath, revision);
>> -            } catch (MicroKernelException e) {
>> -                // FIXME: Better way to determine whether a child node exists
>>             }
>>         }
>
> That's what I was wondering, is a nodeExists() call followed by
> getNodes() better than a getNodes() call by itself? Especially if we
> assume potential network overhead for both calls...

you're right, but in this particular case i replaced a dummy getNodes() call
in a try/catch block with a single nodeExists() call returning a boolean.
i'd argue that the code is cleaner and probably not slower ;)

cheers
stefan


>
> I'll spend some time over the next few days to get us started with
> initial performance benchmarks. That should help us make more informed
> decisions on cases like this.
>
> BR,
>
> Jukka Zitting

Mime
View raw message