You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "David Capwell (Jira)" <ji...@apache.org> on 2021/09/08 17:45:00 UTC

[jira] [Commented] (CASSANDRA-16901) Optimize heavily-used `String.format()`-with-constant formatter use cases

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

David Capwell commented on CASSANDRA-16901:
-------------------------------------------

do you have any cluster benchmarks showing any branches impacted? I agree String.format is slow but it shouldn't really be common in the hot path (else this ticket could get some nice wins)

> Optimize heavily-used `String.format()`-with-constant formatter use cases
> -------------------------------------------------------------------------
>
>                 Key: CASSANDRA-16901
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16901
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Tatu Saloranta
>            Priority: Normal
>
> For background, I did some benchmarking to compare performance of two simple ways to concatenate 2 Strings with a separator (used in f.ex `QualifiedName.java` for "keyspace:name" concatenation):
>  # String.format("%s.%s", keyspace, name);
>  # new StringBuilder().append(keyspace).append('.').append(name).toString()
> Difference is somewhat significant (for me, factor of 40x), as per:
> https://cowtowncoder.medium.com/measuring-performance-of-java-string-format-or-lack-thereof-2e1c6a13362c
> and so it seems worthwhile replacing at least some of usage from Cassandra. With a quick look it seems that classes like:
>  * QualifiedName.java, FieldSelector.java, Selectable.java (in cql3)
> could benefit from this. And the second implementation can be packaged as a simple utility method (concatenateStringsWithChar?) so that code should be as readable as before.
> I can provide a patch, or if anyone else wants to have a go, feel free to.
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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