[ https://issues.apache.org/jira/browse/CASSANDRA-16901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17412150#comment-17412150 ]
Tatu Saloranta commented on CASSANDRA-16901: -------------------------------------------- No, I don't have cluster benchmarks unfortunately. I doubt effect would be big enough to show on latencies; might be visible on heap dumps wrt garbage (assuming `QualifiedName.to[CQL]String()` is heavily used, maybe it isn't). My thinking is more along the lines of this being incremental improvement which would not add complexity (a simple helper method). But I agree that ideally it would show some measurable improvement. > 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-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org