You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Rui Wang (Jira)" <ji...@apache.org> on 2020/02/25 23:47:00 UTC
[jira] [Commented] (CALCITE-3823) Do not use String.replaceAll
[ https://issues.apache.org/jira/browse/CALCITE-3823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17045017#comment-17045017 ]
Rui Wang commented on CALCITE-3823:
-----------------------------------
Wa, thanks for sharing this knowledge.
> Do not use String.replaceAll
> ----------------------------
>
> Key: CALCITE-3823
> URL: https://issues.apache.org/jira/browse/CALCITE-3823
> Project: Calcite
> Issue Type: Bug
> Reporter: Julian Hyde
> Assignee: Julian Hyde
> Priority: Major
>
> We use JDK's {{String.replaceAll(String regex, String replacement)}} about 60 times in the code, but most of these should probably use {{String.replace(CharSequence target, CharSequence replacement)}}.
> {{replaceAll}} uses regex semantics, which is slow (it compiles a pattern each call) and probably not desired behavior.
> Consider adding to {{forbidden-apis/signatures.txt}} to prevent it from being accidentally used in future.
> See tweet "[String.replaceAll is the most invisible java perf issue I end up finding out of profiles|https://twitter.com/t3rmin4t0r/status/1232353433371336704]".
--
This message was sent by Atlassian Jira
(v8.3.4#803005)