Make Formatter %d cost about the same as %s (i.e. 60% faster).
Fast-path "%d" and "%s", the only two cases that matter, so they don't have to
go through all the flags, width, and precision machinery unless flags, widths,
or precisions are actually specified.
This makes "%s" slightly but not significantly faster -- because I'd already
optimized that code for the default case pretty well -- but makes a huge
difference to "%d", which wasn't as amenable to general optimization.
I've also improved the identifiers and comments surrounding the date suffix,
after TraceView misled me into attempting to optimize this non-hotspot (though
to be fair, I'm only benchmarking on passion-eng with JIT; TraceView might be
telling the truth for a G1 without JIT).
TraceView also misled me into trying to optimize away the check for uppercase
conversion types at the end of Transformer.transform (by adding different bodies
to the uppercase entries in the switch directly above it), but that made no
convincing difference on passion-eng.
Bug: 2272346
1 file changed