cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcus Eriksson (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:30:00 GMT

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

Marcus Eriksson commented on CASSANDRA-15033:
---------------------------------------------

Thanks for the patch!

running tests here: https://circleci.com/workflow-run/b7b6cbe6-421d-42e0-8284-7a500cfc895a

[~charsyam] I'll need your email address to set the author properly on the patch

> 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