cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tatu Saloranta (Jira)" <j...@apache.org>
Subject [jira] [Created] (CASSANDRA-16901) Optimize heavily-used `String.format()`-with-constant formatter use cases
Date Tue, 31 Aug 2021 00:00:01 GMT
Tatu Saloranta created CASSANDRA-16901:
------------------------------------------

             Summary: 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


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


Mime
View raw message