On 2016-03-25 17:53, Paul Sandoz wrote:
On 25 Mar 2016, at 17:37, Claes Redestad <[email protected]> wrote:
Interesting, my only concern is we'd add more code/complexity, but it seems the
shift will always be == len when not matching a character in src (the proof is
left out as an exercise), so this can be simplified further to:
byte c = b[i + j];
if (c >= ' ' && c <= 'z') {
if (c >= 'a') c -= 32; // Canonicalize
if (c != src[j]) {
// no match
int goodShift = (j < len - 1) ? len : 1;
int badShift = lastOcc[c - 32];
i += Math.max(j + 1 - badShift, goodShift);
continue next;
}
} else {
// no match, character not valid for name
i += len;
continue next;
}
http://cr.openjdk.java.net/~redestad/8152733/webrev.03/
Nice, that’s quite clear in it’s intent. As long as this meets the performance
goals i am ok with this being slower than other variants, as i think the
reduction in static footprint is a fare trade in this case.
Paul.
Thanks!
Getting a few very marginal but still statistically significant
improvements on startup when comparing to earlier variants of this
patch, so hearing no objections I'll go ahead and push this variant.
/Claes