Hiya,
I've got around to the caliper version and I see the following:
[info] size benchmark ms linear runtime
[info] 50 ScalesXmlTreeNameValue 8.00 =
[info] 50 ScalaXMLTree 6.01 =
[info] 50 ScalesXmlTree 7.65 =
[info] 50 ScalesIterateFull 21.17 =
[info] 50 ScalesIterateFullOld 19.76 =
[info] 50 PullMutable 3.73 =
[info] 100 ScalesXmlTreeNameValue 18.14 =
[info] 100 ScalaXMLTree 11.32 =
[info] 100 ScalesXmlTree 15.10 =
[info] 100 ScalesIterateFull 38.73 ===
[info] 100 ScalesIterateFullOld 38.23 ===
[info] 100 PullMutable 7.31 =
[info] 500 ScalesXmlTreeNameValue 66.56 =====
[info] 500 ScalaXMLTree 66.14 =====
[info] 500 ScalesXmlTree 59.46 ====
[info] 500 ScalesIterateFull 193.90 ===============
[info] 500 ScalesIterateFullOld 178.11 ==============
[info] 500 PullMutable 35.40 ==
[info] 1000 ScalesXmlTreeNameValue 216.23 =================
[info] 1000 ScalaXMLTree 135.15 ==========
[info] 1000 ScalesXmlTree 134.76 ==========
[info] 1000 ScalesIterateFull 348.37 ============================
[info] 1000 ScalesIterateFullOld 369.05 ==============================
[info] 1000 PullMutable 70.17 =====
[info] 5000 ScalesXmlTreeNameValue 734 ========
[info] 5000 ScalaXMLTree 864 =========
[info] 5000 ScalesXmlTree 780 ========
[info] 5000 ScalesIterateFull 989 ===========
[info] 5000 ScalesIterateFullOld 1115 ============
[info] 5000 PullMutable 460 =====
[info] 10000 ScalesXmlTreeNameValue 1510 =================
[info] 10000 ScalaXMLTree 2655 ==============================
[info] 10000 ScalesXmlTree 1548 =================
[info] 10000 ScalesIterateFull 1918 =====================
[info] 10000 ScalesIterateFullOld 1900 =====================
[info] 10000 PullMutable 935 ==========
which matches my intuitions on the speed. The test is attached.
I disabled the children, child code as I'm assuming it produces
incorrect results. This wasn't immediately clear to me, and for that
I apologise, it should have given how annoying it was to implement :-)
When using \\ at the start of an xpath expression it (according to the
xpath 2 spec) it also includes the current node. The expression \\*
includes the "reference" element as well.
I didn't mean to indicate that you should only use a full path, its
just easier to predict the results, but your xml is very regular so I
think the approach pretty good looking.
The results are driven from the upcoming 0.4.4 release (the
ScalesIterateFullOld is the 0.4.3 solution). In all cases your hand
written pull code wins by a significant margin. I'll see if I can't
close that gap a bit for 0.5 :-)