Hi,

a few smaller optimizations for Properties.load:

- when parsing comment lines, we unnecessarily breaks the fast path loop
on backslashes, even though a backslash embedded in a comment line will never have any effect on subsequent logical lines

- inside that same loop, we always do two comparisons in the common case: testing c <= '\r' && c >= '\n' would mean only one comparison in the common case, since c is very likely to be > '\r' (also when reading from a byte stream)

- we currently store everything into temporary char[]'s which we then
instantiate Strings with. Since Compact String this means we often
use more temporary storage than necessary, and do unnecessary work
packing from char[] to byte[] representation internally; by using
StringBuilder encoding transitions is handled more gracefully and is a
speed-up in general (both interpreted and compiled) while simplifying
the code somewhat.

Result is ~5-20% faster depending on how comment-heavy the properties
file we're loading is.

Bug:    https://bugs.openjdk.java.net/browse/JDK-8224202
Webrev: http://cr.openjdk.java.net/~redestad/8224202/open.00/

Testing: tier1-3

Patch is applied on top of JDK-8224240, patch for which is out for
review here: http://mail.openjdk.java.net/pipermail/core-libs-dev/2019-May/060301.html

Thanks!

/Claes

Reply via email to