cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "DaeMyung Kang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-15033) Refactor to singleQuote reuse java.util.regex.Pattern instead of String.replaceAll for TableCQLHelper.java
Date Mon, 04 Mar 2019 14:59:00 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-15033?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16783436#comment-16783436
] 

DaeMyung Kang commented on CASSANDRA-15033:
-------------------------------------------

[~krummas] Thanks. my email is [charsyam@apache.org|mailto:charsyam@apache.org] Thanks.

> Refactor to singleQuote reuse java.util.regex.Pattern instead of String.replaceAll for
TableCQLHelper.java
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-15033
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15033
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL/Interpreter
>            Reporter: DaeMyung Kang
>            Assignee: DaeMyung Kang
>            Priority: Trivial
>         Attachments: patch-15033.patch
>
>
> singleQuote uses `String.replaceAll ()` a lot in loop.
> and 'String.replaceAll()' compiles the regular expression each time it is called.
>  
> {code:java}
> public String replaceAll(String regex, String replacement) {
>     return Pattern.compile(regex).matcher(this).replaceAll(replacement);
>  }{code}
>  
> It is suggested in javadoc (https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#matches(java.lang.String,%20java.lang.CharSequence))
that it is efficient to reuse the pattern.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message