RFR(m, tedious): 8224212: stringStream::as_string() is inefficient
Thomas Stüfe
thomas.stuefe at gmail.com
Tue Jun 4 15:46:49 UTC 2019
Hi all,
may I have your opinion - and, if you think this is worthwhile patch, your
reviews - for the following issue:
webrev:
http://cr.openjdk.java.net/~stuefe/webrevs/8224212-stringstream-as_string-inefficient/webrev.00/webrev/
bug: https://bugs.openjdk.java.net/browse/JDK-8224212
This patch exchanges calls to stringStream::as_string() with
stringStream::base() in a number of places.
stringStream::as_string() creates a temporary copy of the string as
resource area, and for many call sites this is unnecessary and we could
just as well use the internal buffer directly.
I carefully combed thru the many call sites of stringStream::as_string()
and only exchanged those which were clearly obvious: the returned
resource-area string was processed right away, not returned from a function
nore stored, and the associated stringStream was not reset over the
lifetime of the returned string.
At some points I also removed ResourceMark's where not needed anymore
(stringStream does C heap allocation now).
Do you think this makes sense?
Thanks, Thomas
More information about the hotspot-dev
mailing list