You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/03/10 00:17:14 UTC

[GitHub] [netbeans] mbien commented on pull request #3724: project wide refactoring: avoid String.replaceAll() if possible.

mbien commented on pull request #3724:
URL: https://github.com/apache/netbeans/pull/3724#issuecomment-1063513808


   > Looks good to me.
   
   thanks for reviewing!
   > 
   > One thing to note: `replace(String, String)` in case of both Strings being of length one could instead use `replace(char, char)`.
   
   This used to be a good advice, but this method is intensified and has the same performance as the char variant on modern JVMs. The only String/char based method left which still behaves differently performance wise is `indexOf`. So its more of a matter of preference now - no longer a performance optimization.
   
   sidenote: I actually tried to add a fast path for `indexOf` https://github.com/openjdk/jdk/pull/6509 but it turned out that under certain circumstances (String lengths) the String variant is actually faster than the char variant due to different vectorization heuristics (this shouldn't happen). This would have to be fixed first otherwise it is not possible to make assumptions of which path is actually faster.


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists