Fwd: Jaxen performance test results

View: New views
4 Messages — Rating Filter:   Alert me  

Parent Message unknown Fwd: Jaxen performance test results

by Baz-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hoping these attachments make it through... Aleksander sent me these
benchmarks made using the nux XQueryBenchmark script. The jaxen-31
lazy-loading came out consistently worse, even on paths where it
should have performed better. For some paths this is expected due to
the additional overhead, but it shouldn't have been worse for all so I
took a look.

Internally the benchmark uses xom's Node.query() to get back a list of
nodes, rather than calling jaxen directly (the code is here:
https://bosshog.lbl.gov/repos/java-u3/tags/v1_1/nux/src/nux/xom/tests/XQueryBenchmark.java
). So I took a look at what Node does, excerpting the relevant bits:

            JaxenConnector connector = new JaxenConnector(xpath);
            // ...
            List queryResults = connector.selectNodes(this);
            Iterator iterator = queryResults.iterator();
            while (iterator.hasNext()) {
                Object o = iterator.next()
                // ...
            }

^ since this code iterates over all returned nodes, it forces full
evaluation of the nodeset, ie it will always be as slow as possible.
The benchmark doesn't force full evaluation, so will penalize this
implementation versus the various JAXP engines tested. It doesn't
include tests like 'boolean(/x/y/z/)'  - which would be fast - since
the Node.query() api doesn't support that kind of xpath.

-Baz

---------- Forwarded message ----------
From: Aleksander Adamowski <aleksander.adamowski@...>
Date: 2009/10/21
Subject: Jaxen performance test results
To: Brian Ewins <Brian.Ewins@...>




--
Aleksander Adamowski
 http://olo.org.pl

$ ./nux-xpath_benchmark.sh 1.1.2
Jaxen version: 1.1.2
Classpath:
lib/nux.jar;lib/saxon8.jar;../..//xom-1.2.3_jaxen-1.1.2.jar
Environment: java 1.6.0_07, Java HotSpot(TM) Server VM, Sun Microsystems Inc., Windows XP, 5.1, x86
Now running java nux.xom.tests.XQueryBenchmark 1000 3 xom samples/data/romeo.xml samples/xpath/queries1.xml
Now reading samples/data/romeo.xml ms=250
Now reading samples/xpath/queries1.xml ms=15
query = following-sibling::*   ms=156, queries/sec=6410.2563
query = preceding-sibling::*   ms=63, queries/sec=15873.016
query = ancestor-or-self::*   ms=31, queries/sec=32258.064
query = descendant::*   ms=31, queries/sec=32258.064
query = //*   ms=23250, queries/sec=43.010754
query = //line | //speaker   ms=13453, queries/sec=74.33286
query = 'Hello World!'  ****** XOM can't handle this query: XPath expression 'Hello World!' did not return a node-set.
 ms=0, queries/sec=Infinity
query = count(//line)  ****** XOM can't handle this query: XPath expression count(//line) did not return a node-set.
 ms=16, queries/sec=62499.996
query = //line   ms=5750, queries/sec=173.91304
query = 1+1  ****** XOM can't handle this query: XPath expression 1+1 did not return a node-set.
 ms=0, queries/sec=Infinity
query = //speech[speaker = 'Rom.']   ms=5484, queries/sec=182.34865
query = //speech[speaker = 'Jul.']   ms=5469, queries/sec=182.84879
query = //line[ancestor::act[@id='5']/scene[@id='3']]   ms=8875, queries/sec=112.676056
query = true() and true() and true() and true() and true()  ****** XOM can't handle this query: XPath expression true() and true() and true() and true() and true() did not return a node-set.
 ms=16, queries/sec=62499.996
query = //*[@id]   ms=6797, queries/sec=147.12373
query = (count(descendant::*) + count(ancestor::*) + count(following::*) + count(preceding::*)) >= 5034  ****** XOM can't handle this query: XPath expression (count(descendant::*) + count(ancestor::*) + count(following::*) + count(preceding::*)) >= 5034 did not return a node-set.
 ms=16, queries/sec=62499.996
query = contains('1234567890','9')  ****** XOM can't handle this query: XPath expression contains('1234567890','9') did not return a node-set.
 ms=0, queries/sec=Infinity
query = //processing-instruction()   ms=6609, queries/sec=151.30882
query = following-sibling::*   ms=16, queries/sec=62499.996
query = name(node())  ****** XOM can't handle this query: XPath expression name(node()) did not return a node-set.
 ms=0, queries/sec=Infinity
query = sum(//act/@id)  ****** XOM can't handle this query: XPath expression sum(//act/@id) did not return a node-set.
 ms=15, queries/sec=66666.67
query = /guttext/play/playbody/act[@id='5']/scene[@id='3']/speech   ms=78, queries/sec=12820.513
query = normalize-space(string(distinct-values(/guttext/markupmeta/gutdate)))  ****** XOM can't handle this query: XPath error: No Such Function distinct-values
 ms=0, queries/sec=Infinity
query = substring('12345', -42, 1.0e0 div 0)  ****** XOM can't handle this query: XPath error: Expected: )
 ms=0, queries/sec=Infinity
query = substring('12345', 0, 3)  ****** XOM can't handle this query: XPath expression substring('12345', 0, 3) did not return a node-set.
 ms=0, queries/sec=Infinity
query = substring('12345', 1.5, 2.6)  ****** XOM can't handle this query: XPath expression substring('12345', 1.5, 2.6) did not return a node-set.
 ms=0, queries/sec=Infinity
query = -5 mod -2  ****** XOM can't handle this query: XPath expression -5 mod -2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = -5 mod 2  ****** XOM can't handle this query: XPath expression -5 mod 2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = 5 mod -2  ****** XOM can't handle this query: XPath expression 5 mod -2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = 5 mod 2  ****** XOM can't handle this query: XPath expression 5 mod 2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = normalize-space( '  qwerty ' )  ****** XOM can't handle this query: XPath expression normalize-space( '  qwerty ' ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = ceiling( 3.1415 )  ****** XOM can't handle this query: XPath expression ceiling( 3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = floor( 3.1415 )  ****** XOM can't handle this query: XPath expression floor( 3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = ceiling( -3.1415 )  ****** XOM can't handle this query: XPath expression ceiling( -3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = floor( -3.1415 )  ****** XOM can't handle this query: XPath expression floor( -3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = /guttext/play/playbody/act   ms=94, queries/sec=10638.298
done with repetition 0


Now reading samples/xpath/queries1.xml ms=0
query = following-sibling::*   ms=47, queries/sec=21276.596
query = preceding-sibling::*   ms=15, queries/sec=66666.67
query = ancestor-or-self::*   ms=16, queries/sec=62499.996
query = descendant::*   ms=15, queries/sec=66666.67
query = //*   ms=22641, queries/sec=44.16766
query = //line | //speaker   ms=13187, queries/sec=75.83226
query = 'Hello World!'  ****** XOM can't handle this query: XPath expression 'Hello World!' did not return a node-set.
 ms=0, queries/sec=Infinity
query = count(//line)  ****** XOM can't handle this query: XPath expression count(//line) did not return a node-set.
 ms=16, queries/sec=62499.996
query = //line   ms=5640, queries/sec=177.30496
query = 1+1  ****** XOM can't handle this query: XPath expression 1+1 did not return a node-set.
 ms=0, queries/sec=Infinity
query = //speech[speaker = 'Rom.']   ms=5297, queries/sec=188.7861
query = //speech[speaker = 'Jul.']   ms=5282, queries/sec=189.32222
query = //line[ancestor::act[@id='5']/scene[@id='3']]   ms=8593, queries/sec=116.37379
query = true() and true() and true() and true() and true()  ****** XOM can't handle this query: XPath expression true() and true() and true() and true() and true() did not return a node-set.
 ms=0, queries/sec=Infinity
query = //*[@id]   ms=6672, queries/sec=149.8801
query = (count(descendant::*) + count(ancestor::*) + count(following::*) + count(preceding::*)) >= 5034  ****** XOM can't handle this query: XPath expression (count(descendant::*) + count(ancestor::*) + count(following::*) + count(preceding::*)) >= 5034 did not return a node-set.
 ms=16, queries/sec=62499.996
query = contains('1234567890','9')  ****** XOM can't handle this query: XPath expression contains('1234567890','9') did not return a node-set.
 ms=0, queries/sec=Infinity
query = //processing-instruction()   ms=6484, queries/sec=154.22578
query = following-sibling::*   ms=16, queries/sec=62499.996
query = name(node())  ****** XOM can't handle this query: XPath expression name(node()) did not return a node-set.
 ms=0, queries/sec=Infinity
query = sum(//act/@id)  ****** XOM can't handle this query: XPath expression sum(//act/@id) did not return a node-set.
 ms=0, queries/sec=Infinity
query = /guttext/play/playbody/act[@id='5']/scene[@id='3']/speech   ms=78, queries/sec=12820.513
query = normalize-space(string(distinct-values(/guttext/markupmeta/gutdate)))  ****** XOM can't handle this query: XPath error: No Such Function distinct-values
 ms=0, queries/sec=Infinity
query = substring('12345', -42, 1.0e0 div 0)  ****** XOM can't handle this query: XPath error: Expected: )
 ms=0, queries/sec=Infinity
query = substring('12345', 0, 3)  ****** XOM can't handle this query: XPath expression substring('12345', 0, 3) did not return a node-set.
 ms=0, queries/sec=Infinity
query = substring('12345', 1.5, 2.6)  ****** XOM can't handle this query: XPath expression substring('12345', 1.5, 2.6) did not return a node-set.
 ms=0, queries/sec=Infinity
query = -5 mod -2  ****** XOM can't handle this query: XPath expression -5 mod -2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = -5 mod 2  ****** XOM can't handle this query: XPath expression -5 mod 2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = 5 mod -2  ****** XOM can't handle this query: XPath expression 5 mod -2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = 5 mod 2  ****** XOM can't handle this query: XPath expression 5 mod 2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = normalize-space( '  qwerty ' )  ****** XOM can't handle this query: XPath expression normalize-space( '  qwerty ' ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = ceiling( 3.1415 )  ****** XOM can't handle this query: XPath expression ceiling( 3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = floor( 3.1415 )  ****** XOM can't handle this query: XPath expression floor( 3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = ceiling( -3.1415 )  ****** XOM can't handle this query: XPath expression ceiling( -3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = floor( -3.1415 )  ****** XOM can't handle this query: XPath expression floor( -3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = /guttext/play/playbody/act   ms=15, queries/sec=66666.67
done with repetition 1


Now reading samples/xpath/queries1.xml ms=0
query = following-sibling::*   ms=31, queries/sec=32258.064
query = preceding-sibling::*   ms=0, queries/sec=Infinity
query = ancestor-or-self::*   ms=16, queries/sec=62499.996
query = descendant::*   ms=16, queries/sec=62499.996
query = //*   ms=22656, queries/sec=44.138416
query = //line | //speaker   ms=13312, queries/sec=75.12019
query = 'Hello World!'  ****** XOM can't handle this query: XPath expression 'Hello World!' did not return a node-set.
 ms=0, queries/sec=Infinity
query = count(//line)  ****** XOM can't handle this query: XPath expression count(//line) did not return a node-set.
 ms=0, queries/sec=Infinity
query = //line   ms=5704, queries/sec=175.31557
query = 1+1  ****** XOM can't handle this query: XPath expression 1+1 did not return a node-set.
 ms=0, queries/sec=Infinity
query = //speech[speaker = 'Rom.']   ms=5343, queries/sec=187.16077
query = //speech[speaker = 'Jul.']   ms=5313, queries/sec=188.21758
query = //line[ancestor::act[@id='5']/scene[@id='3']]   ms=8700, queries/sec=114.94253
query = true() and true() and true() and true() and true()  ****** XOM can't handle this query: XPath expression true() and true() and true() and true() and true() did not return a node-set.
 ms=0, queries/sec=Infinity
query = //*[@id]   ms=6656, queries/sec=150.24039
query = (count(descendant::*) + count(ancestor::*) + count(following::*) + count(preceding::*)) >= 5034  ****** XOM can't handle this query: XPath expression (count(descendant::*) + count(ancestor::*) + count(following::*) + count(preceding::*)) >= 5034 did not return a node-set.
 ms=0, queries/sec=Infinity
query = contains('1234567890','9')  ****** XOM can't handle this query: XPath expression contains('1234567890','9') did not return a node-set.
 ms=0, queries/sec=Infinity
query = //processing-instruction()   ms=6500, queries/sec=153.84616
query = following-sibling::*   ms=0, queries/sec=Infinity
query = name(node())  ****** XOM can't handle this query: XPath expression name(node()) did not return a node-set.
 ms=0, queries/sec=Infinity
query = sum(//act/@id)  ****** XOM can't handle this query: XPath expression sum(//act/@id) did not return a node-set.
 ms=16, queries/sec=62499.996
query = /guttext/play/playbody/act[@id='5']/scene[@id='3']/speech   ms=31, queries/sec=32258.064
query = normalize-space(string(distinct-values(/guttext/markupmeta/gutdate)))  ****** XOM can't handle this query: XPath error: No Such Function distinct-values
 ms=0, queries/sec=Infinity
query = substring('12345', -42, 1.0e0 div 0)  ****** XOM can't handle this query: XPath error: Expected: )
 ms=0, queries/sec=Infinity
query = substring('12345', 0, 3)  ****** XOM can't handle this query: XPath expression substring('12345', 0, 3) did not return a node-set.
 ms=0, queries/sec=Infinity
query = substring('12345', 1.5, 2.6)  ****** XOM can't handle this query: XPath expression substring('12345', 1.5, 2.6) did not return a node-set.
 ms=0, queries/sec=Infinity
query = -5 mod -2  ****** XOM can't handle this query: XPath expression -5 mod -2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = -5 mod 2  ****** XOM can't handle this query: XPath expression -5 mod 2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = 5 mod -2  ****** XOM can't handle this query: XPath expression 5 mod -2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = 5 mod 2  ****** XOM can't handle this query: XPath expression 5 mod 2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = normalize-space( '  qwerty ' )  ****** XOM can't handle this query: XPath expression normalize-space( '  qwerty ' ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = ceiling( 3.1415 )  ****** XOM can't handle this query: XPath expression ceiling( 3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = floor( 3.1415 )  ****** XOM can't handle this query: XPath expression floor( 3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = ceiling( -3.1415 )  ****** XOM can't handle this query: XPath expression ceiling( -3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = floor( -3.1415 )  ****** XOM can't handle this query: XPath expression floor( -3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = /guttext/play/playbody/act   ms=0, queries/sec=Infinity
done with repetition 2


$ ./nux-xpath_benchmark.sh 1.1.3
Jaxen version: 1.1.3
Classpath:
lib/nux.jar;lib/saxon8.jar;../..//xom-1.2.3_jaxen-1.1.3.jar
Environment: java 1.6.0_07, Java HotSpot(TM) Server VM, Sun Microsystems Inc., Windows XP, 5.1, x86
Now running java nux.xom.tests.XQueryBenchmark 1000 3 xom samples/data/romeo.xml samples/xpath/queries1.xml
Now reading samples/data/romeo.xml ms=266
Now reading samples/xpath/queries1.xml ms=15
query = following-sibling::*   ms=187, queries/sec=5347.5933
query = preceding-sibling::*   ms=47, queries/sec=21276.596
query = ancestor-or-self::*   ms=47, queries/sec=21276.596
query = descendant::*   ms=31, queries/sec=32258.064
query = //*   ms=27594, queries/sec=36.23976
query = //line | //speaker   ms=18984, queries/sec=52.67594
query = 'Hello World!'  ****** XOM can't handle this query: XPath expression 'Hello World!' did not return a node-set.
 ms=0, queries/sec=Infinity
query = count(//line)  ****** XOM can't handle this query: XPath expression count(//line) did not return a node-set.
 ms=0, queries/sec=Infinity
query = //line   ms=8687, queries/sec=115.11453
query = 1+1  ****** XOM can't handle this query: XPath expression 1+1 did not return a node-set.
 ms=0, queries/sec=Infinity
query = //speech[speaker = 'Rom.']   ms=8328, queries/sec=120.07685
query = //speech[speaker = 'Jul.']   ms=8078, queries/sec=123.793015
query = //line[ancestor::act[@id='5']/scene[@id='3']]   ms=17063, queries/sec=58.606342
query = true() and true() and true() and true() and true()  ****** XOM can't handle this query: XPath expression true() and true() and true() and true() and true() did not return a node-set.
 ms=15, queries/sec=66666.67
query = //*[@id]   ms=11500, queries/sec=86.95652
query = (count(descendant::*) + count(ancestor::*) + count(following::*) + count(preceding::*)) >= 5034  ****** XOM can't handle this query: XPath expression (count(descendant::*) + count(ancestor::*) + count(following::*) + count(preceding::*)) >= 5034 did not return a node-set.
 ms=16, queries/sec=62499.996
query = contains('1234567890','9')  ****** XOM can't handle this query: XPath expression contains('1234567890','9') did not return a node-set.
 ms=0, queries/sec=Infinity
query = //processing-instruction()   ms=7891, queries/sec=126.726654
query = following-sibling::*   ms=15, queries/sec=66666.67
query = name(node())  ****** XOM can't handle this query: XPath expression name(node()) did not return a node-set.
 ms=0, queries/sec=Infinity
query = sum(//act/@id)  ****** XOM can't handle this query: XPath expression sum(//act/@id) did not return a node-set.
 ms=16, queries/sec=62499.996
query = /guttext/play/playbody/act[@id='5']/scene[@id='3']/speech   ms=94, queries/sec=10638.298
query = normalize-space(string(distinct-values(/guttext/markupmeta/gutdate)))  ****** XOM can't handle this query: XPath error: No Such Function distinct-values
 ms=0, queries/sec=Infinity
query = substring('12345', -42, 1.0e0 div 0)  ****** XOM can't handle this query: XPath error: Expected: )
 ms=0, queries/sec=Infinity
query = substring('12345', 0, 3)  ****** XOM can't handle this query: XPath expression substring('12345', 0, 3) did not return a node-set.
 ms=0, queries/sec=Infinity
query = substring('12345', 1.5, 2.6)  ****** XOM can't handle this query: XPath expression substring('12345', 1.5, 2.6) did not return a node-set.
 ms=0, queries/sec=Infinity
query = -5 mod -2  ****** XOM can't handle this query: XPath expression -5 mod -2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = -5 mod 2  ****** XOM can't handle this query: XPath expression -5 mod 2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = 5 mod -2  ****** XOM can't handle this query: XPath expression 5 mod -2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = 5 mod 2  ****** XOM can't handle this query: XPath expression 5 mod 2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = normalize-space( '  qwerty ' )  ****** XOM can't handle this query: XPath expression normalize-space( '  qwerty ' ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = ceiling( 3.1415 )  ****** XOM can't handle this query: XPath expression ceiling( 3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = floor( 3.1415 )  ****** XOM can't handle this query: XPath expression floor( 3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = ceiling( -3.1415 )  ****** XOM can't handle this query: XPath expression ceiling( -3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = floor( -3.1415 )  ****** XOM can't handle this query: XPath expression floor( -3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = /guttext/play/playbody/act   ms=110, queries/sec=9090.909
done with repetition 0


Now reading samples/xpath/queries1.xml ms=0
query = following-sibling::*   ms=78, queries/sec=12820.513
query = preceding-sibling::*   ms=47, queries/sec=21276.596
query = ancestor-or-self::*   ms=15, queries/sec=66666.67
query = descendant::*   ms=32, queries/sec=31249.998
query = //*   ms=27421, queries/sec=36.4684
query = //line | //speaker   ms=19500, queries/sec=51.28205
query = 'Hello World!'  ****** XOM can't handle this query: XPath expression 'Hello World!' did not return a node-set.
 ms=0, queries/sec=Infinity
query = count(//line)  ****** XOM can't handle this query: XPath expression count(//line) did not return a node-set.
 ms=0, queries/sec=Infinity
query = //line   ms=8750, queries/sec=114.28571
query = 1+1  ****** XOM can't handle this query: XPath expression 1+1 did not return a node-set.
 ms=0, queries/sec=Infinity
query = //speech[speaker = 'Rom.']   ms=8141, queries/sec=122.83504
query = //speech[speaker = 'Jul.']   ms=8125, queries/sec=123.07692
query = //line[ancestor::act[@id='5']/scene[@id='3']]   ms=16938, queries/sec=59.03885
query = true() and true() and true() and true() and true()  ****** XOM can't handle this query: XPath expression true() and true() and true() and true() and true() did not return a node-set.
 ms=0, queries/sec=Infinity
query = //*[@id]   ms=11484, queries/sec=87.077675
query = (count(descendant::*) + count(ancestor::*) + count(following::*) + count(preceding::*)) >= 5034  ****** XOM can't handle this query: XPath expression (count(descendant::*) + count(ancestor::*) + count(following::*) + count(preceding::*)) >= 5034 did not return a node-set.
 ms=0, queries/sec=Infinity
query = contains('1234567890','9')  ****** XOM can't handle this query: XPath expression contains('1234567890','9') did not return a node-set.
 ms=0, queries/sec=Infinity
query = //processing-instruction()   ms=7812, queries/sec=128.0082
query = following-sibling::*   ms=16, queries/sec=62499.996
query = name(node())  ****** XOM can't handle this query: XPath expression name(node()) did not return a node-set.
 ms=0, queries/sec=Infinity
query = sum(//act/@id)  ****** XOM can't handle this query: XPath expression sum(//act/@id) did not return a node-set.
 ms=0, queries/sec=Infinity
query = /guttext/play/playbody/act[@id='5']/scene[@id='3']/speech   ms=47, queries/sec=21276.596
query = normalize-space(string(distinct-values(/guttext/markupmeta/gutdate)))  ****** XOM can't handle this query: XPath error: No Such Function distinct-values
 ms=0, queries/sec=Infinity
query = substring('12345', -42, 1.0e0 div 0)  ****** XOM can't handle this query: XPath error: Expected: )
 ms=0, queries/sec=Infinity
query = substring('12345', 0, 3)  ****** XOM can't handle this query: XPath expression substring('12345', 0, 3) did not return a node-set.
 ms=0, queries/sec=Infinity
query = substring('12345', 1.5, 2.6)  ****** XOM can't handle this query: XPath expression substring('12345', 1.5, 2.6) did not return a node-set.
 ms=0, queries/sec=Infinity
query = -5 mod -2  ****** XOM can't handle this query: XPath expression -5 mod -2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = -5 mod 2  ****** XOM can't handle this query: XPath expression -5 mod 2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = 5 mod -2  ****** XOM can't handle this query: XPath expression 5 mod -2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = 5 mod 2  ****** XOM can't handle this query: XPath expression 5 mod 2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = normalize-space( '  qwerty ' )  ****** XOM can't handle this query: XPath expression normalize-space( '  qwerty ' ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = ceiling( 3.1415 )  ****** XOM can't handle this query: XPath expression ceiling( 3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = floor( 3.1415 )  ****** XOM can't handle this query: XPath expression floor( 3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = ceiling( -3.1415 )  ****** XOM can't handle this query: XPath expression ceiling( -3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = floor( -3.1415 )  ****** XOM can't handle this query: XPath expression floor( -3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = /guttext/play/playbody/act   ms=15, queries/sec=66666.67
done with repetition 1


Now reading samples/xpath/queries1.xml ms=0
query = following-sibling::*   ms=63, queries/sec=15873.016
query = preceding-sibling::*   ms=15, queries/sec=66666.67
query = ancestor-or-self::*   ms=0, queries/sec=Infinity
query = descendant::*   ms=0, queries/sec=Infinity
query = //*   ms=27453, queries/sec=36.42589
query = //line | //speaker   ms=19516, queries/sec=51.240005
query = 'Hello World!'  ****** XOM can't handle this query: XPath expression 'Hello World!' did not return a node-set.
 ms=0, queries/sec=Infinity
query = count(//line)  ****** XOM can't handle this query: XPath expression count(//line) did not return a node-set.
 ms=0, queries/sec=Infinity
query = //line   ms=8750, queries/sec=114.28571
query = 1+1  ****** XOM can't handle this query: XPath expression 1+1 did not return a node-set.
 ms=0, queries/sec=Infinity
query = //speech[speaker = 'Rom.']   ms=8140, queries/sec=122.85012
query = //speech[speaker = 'Jul.']   ms=8125, queries/sec=123.07692
query = //line[ancestor::act[@id='5']/scene[@id='3']]   ms=16891, queries/sec=59.203125
query = true() and true() and true() and true() and true()  ****** XOM can't handle this query: XPath expression true() and true() and true() and true() and true() did not return a node-set.
 ms=0, queries/sec=Infinity
query = //*[@id]   ms=11484, queries/sec=87.077675
query = (count(descendant::*) + count(ancestor::*) + count(following::*) + count(preceding::*)) >= 5034  ****** XOM can't handle this query: XPath expression (count(descendant::*) + count(ancestor::*) + count(following::*) + count(preceding::*)) >= 5034 did not return a node-set.
 ms=0, queries/sec=Infinity
query = contains('1234567890','9')  ****** XOM can't handle this query: XPath expression contains('1234567890','9') did not return a node-set.
 ms=0, queries/sec=Infinity
query = //processing-instruction()   ms=7828, queries/sec=127.74655
query = following-sibling::*   ms=16, queries/sec=62499.996
query = name(node())  ****** XOM can't handle this query: XPath expression name(node()) did not return a node-set.
 ms=0, queries/sec=Infinity
query = sum(//act/@id)  ****** XOM can't handle this query: XPath expression sum(//act/@id) did not return a node-set.
 ms=0, queries/sec=Infinity
query = /guttext/play/playbody/act[@id='5']/scene[@id='3']/speech   ms=63, queries/sec=15873.016
query = normalize-space(string(distinct-values(/guttext/markupmeta/gutdate)))  ****** XOM can't handle this query: XPath error: No Such Function distinct-values
 ms=0, queries/sec=Infinity
query = substring('12345', -42, 1.0e0 div 0)  ****** XOM can't handle this query: XPath error: Expected: )
 ms=0, queries/sec=Infinity
query = substring('12345', 0, 3)  ****** XOM can't handle this query: XPath expression substring('12345', 0, 3) did not return a node-set.
 ms=0, queries/sec=Infinity
query = substring('12345', 1.5, 2.6)  ****** XOM can't handle this query: XPath expression substring('12345', 1.5, 2.6) did not return a node-set.
 ms=0, queries/sec=Infinity
query = -5 mod -2  ****** XOM can't handle this query: XPath expression -5 mod -2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = -5 mod 2  ****** XOM can't handle this query: XPath expression -5 mod 2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = 5 mod -2  ****** XOM can't handle this query: XPath expression 5 mod -2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = 5 mod 2  ****** XOM can't handle this query: XPath expression 5 mod 2 did not return a node-set.
 ms=0, queries/sec=Infinity
query = normalize-space( '  qwerty ' )  ****** XOM can't handle this query: XPath expression normalize-space( '  qwerty ' ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = ceiling( 3.1415 )  ****** XOM can't handle this query: XPath expression ceiling( 3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = floor( 3.1415 )  ****** XOM can't handle this query: XPath expression floor( 3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = ceiling( -3.1415 )  ****** XOM can't handle this query: XPath expression ceiling( -3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = floor( -3.1415 )  ****** XOM can't handle this query: XPath expression floor( -3.1415 ) did not return a node-set.
 ms=0, queries/sec=Infinity
query = /guttext/play/playbody/act   ms=15, queries/sec=66666.67
done with repetition 2


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Re: Fwd: Jaxen performance test results

by Elliotte Rusty Harold-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Oct 21, 2009 at 9:52 AM, Baz <brian.ewins@...> wrote:

> Internally the benchmark uses xom's Node.query() to get back a list of
> nodes, rather than calling jaxen directly (the code is here:
> https://bosshog.lbl.gov/repos/java-u3/tags/v1_1/nux/src/nux/xom/tests/XQueryBenchmark.java
> ). So I took a look at what Node does, excerpting the relevant bits:
>
>            JaxenConnector connector = new JaxenConnector(xpath);
>            // ...
>            List queryResults = connector.selectNodes(this);
>            Iterator iterator = queryResults.iterator();
>            while (iterator.hasNext()) {
>                Object o = iterator.next()
>                // ...
>            }


There might be some things I can do to optimize that path and avoid
early loading, but nothing too easy or obvious. For jaxen's own
purposes I would suggest a benchmark based purely on DOM.

--
Elliotte Rusty Harold
elharo@...

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Fwd: Jaxen performance test results

by Elliotte Rusty Harold-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Oct 21, 2009 at 9:52 AM, Baz <brian.ewins@...> wrote:

> Internally the benchmark uses xom's Node.query() to get back a list of
> nodes, rather than calling jaxen directly (the code is here:
> https://bosshog.lbl.gov/repos/java-u3/tags/v1_1/nux/src/nux/xom/tests/XQueryBenchmark.java
> ). So I took a look at what Node does, excerpting the relevant bits:
>
>            JaxenConnector connector = new JaxenConnector(xpath);
>            // ...
>            List queryResults = connector.selectNodes(this);
>            Iterator iterator = queryResults.iterator();
>            while (iterator.hasNext()) {
>                Object o = iterator.next()
>                // ...


Actually the relevant bit may be even higher up the call chain. This
has already happened by the time you get to the code you noticed:

    public List selectNodes(Object expression) throws JaxenException {

        List result = super.selectNodes(expression);
        // Text objects are returned wrapped in a List.
        // We need to unwrap them here.
        ListIterator iterator = result.listIterator();
        while (iterator.hasNext()) {
            Object next = iterator.next();
            if (next instanceof List) {
                List list = (List) next;
                // replace the list with the first item in the list
                iterator.set(list.get(0));
                // insert any subsequent Text objects into the list
                if (list.size() > 1) {
                    Iterator texts = list.listIterator(1);
                    while (texts.hasNext()) {
                        iterator.add(texts.next());
                    }
                }
            }
        }
        return result;

    }


So I'm iterating through the list twice. If nothing else, I suspect I
can get that down to a single iteration. However I'm not sure I can
eliminate the iteration completely.

--
Elliotte Rusty Harold
elharo@...

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Fwd: Jaxen performance test results

by Elliotte Rusty Harold-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Oct 21, 2009 at 9:52 AM, Baz <brian.ewins@...> wrote:

> ^ since this code iterates over all returned nodes, it forces full
> evaluation of the nodeset, ie it will always be as slow as possible.
> The benchmark doesn't force full evaluation, so will penalize this
> implementation versus the various JAXP engines tested. It doesn't
> include tests like 'boolean(/x/y/z/)'  - which would be fast - since
> the Node.query() api doesn't support that kind of xpath.

In CVS I have eliminated the iteration you noted in XOM. However I did
this by combining it with another iteration in JaxenConnector you
didn't notice so the effect is likely small at best, and doesn't stop
the loading of the list. However one pass through the list is still
likely better than two.

I'm not sure I can really fix this because XOM needs to update the
list returned to take account of differences between XPath's/Jaxen's
data model and XOM's.

Practically I suspect the real performance win for XOM would be
caching the compiled XPath expressions.

--
Elliotte Rusty Harold
elharo@...

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email