eppleton commented on code in PR #9789:
URL: https://github.com/apache/netbeans/pull/9789#discussion_r4510811769
##########
profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/details/basic/StringDetailsProvider.java:
##########
@@ -34,14 +34,18 @@
*/
@ServiceProvider(service=DetailsProvider.class)
public final class StringDetailsProvider extends DetailsProvider.Basic {
-
+ // caching two fields
+ private int hiShift = -1;
+ private int loShift = -1;
Review Comment:
From reading the code: `getJDK9String` resets both fields to `-1` on every
call, so effectively there is no cache across strings (or heaps). The lookup
happens once per string, as in the old `StringDecoder`. But the fields are
mutable state on a `@ServiceProvider` singleton, so two concurrent calls could
see `hiShift` set while `loShift` is still `-1`. Given that `ArrayValueView`
still uses `StringDecoder`, and that the actual fix is the boxing in
`InstanceImpl` (it's what makes `coder` readable), would keeping
`StringDecoder` here work as well?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists