Please take a review at
http://cr.openjdk.java.net/~weijun/8179389/webrev.00/
The bug report [1] is correct that the frequent reallocation of data is
the problem. This fix above delegate this task to ByteArrayOutputStream.
There is no significant performance difference between this fix and the
suggested fix in the bug report.
The "if (next != 9 && next != 10 && next != 13 && next != 32)" filter is
equivalent to replaceAll("\\s+", "") in Pem.decode().
noreg-perf.
Thanks
Max
[1] https://bugs.openjdk.java.net/browse/JDK-8179389
[2]
http://web.localhost/%7Eww155710/cgi-bin/hgwebdir.cgi/jdk9/dev/jdk/file/d34833290472/src/java.base/share/classes/sun/security/util/Pem.java#l46