Bottleneck in ExpressionParser
The Saxon XSLT and XQuery processor, developed by Saxonica
Brought to you by:
mhkay
Hello,
I've noticed this:
if ("".equals(parts[0])) {
In ExpressionParser. That's going to be quite slow if
executed lots of times, so it would be nicer to write this:
if (parts[0].length() == 0) {
Assuming parts[0] is always a String, otherwise:
if (parts[0]!=null && parts[0].length()==0) {
There are a few instances of this in ExpressionParser.
While one wouldn't notice this as a performance issue
if executed once, when executed many times it will
noticable - and it's so easy to fix :-)
John
Logged In: YES
user_id=251681
I doubt very much whether the effect of this change would be
noticeable. I ran a little microbenchmark testing 3 million
strings and the elapsed time improved from 1232ms to 1182ms.
The expression parser doesn't get to test 3 million QName
prefixes very often. There are much greater inefficiencies
elsewhere in the compilation phase, since most of my
performance efforts have been geared towards run-time
performance rather than compile-time. If we're going to
embark on an exercise to improve compile time performance,
then it needs to be methodical - based on actual
measurements of end-to-end costs and analysis of hotspots -
and it should aim to give a doubling of performance, not 1%
here and 1% there. The change you suggest might be easy, but
it's not a priority.