I wrote:
>
>
>
> I'll test again on some longer fragments since you don't seem convinced.
>
>
I set up a test with a much larger XML fragment - over 1Mb - basically
it's the English source of the SVN Turtle book.
The result is that the extra parsing cost is still pretty much unmeasurable:
regression=# select avg(length(foo)) from (select
repeat(xpath('//title',src)::text,i) as foo from xpathtest4,
generate_series(1,100) as i ) x; avg
----------------------1309869.000000000000
(1 row)
Without fix:
Time: 5695.930 ms
Time: 4855.837 ms
Time: 5453.044 ms
With fix:
Time: 5232.810 ms
Time: 5272.375 ms
Time: 5528.434 ms
So I'm going to go ahead and commit this change for 8.3, with Tom's
suggested ammendments.
cheers
andrew