[
https://issues.apache.org/jira/browse/CASSANDRA-12343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15407744#comment-15407744
]
Robert Stupp commented on CASSANDRA-12343:
------------------------------------------
No text or so, Aleksey Shipilëv mentioned it in [this
video|https://youtu.be/wIyeOaitmWM?t=1379] at ~23:00 about Java9 string
optimizations. The whole video is worth to watch.
Committed as
[54836ec0c5f41fed53c1010acb27f311e615a7f3|https://github.com/apache/cassandra/commit/54836ec0c5f41fed53c1010acb27f311e615a7f3]
to [trunk|https://github.com/apache/cassandra/tree/trunk]
> Make 'static final boolean' easier to optimize for Hotspot
> ----------------------------------------------------------
>
> Key: CASSANDRA-12343
> URL: https://issues.apache.org/jira/browse/CASSANDRA-12343
> Project: Cassandra
> Issue Type: Improvement
> Reporter: Robert Stupp
> Assignee: Robert Stupp
> Priority: Trivial
> Fix For: 3.10
>
>
> Hotspot is able to optimize condition checks on `static final` fields. But
> the compiler can only optimize if the referenced "constant" is the first
> condition to check. (If I understood the optimization in Hotspot correctly.)
> I.e. the first {{if}} block can be "eliminated" whereas the second cannot:
> {code}
> class Foo {
> static final boolean CONST = /* some fragment evaluating to false */;
>
> public void doSomeStuff(boolean param) {
> if (!CONST) {
> // this code block can be eliminated
> }
> if (!CONST && param) {
> // this code block can be eliminated
> }
> if (param && !CONST) {
> // this code block cannot be eliminated due to some compiler logic
> }
>
> }
> }
> {code}
> Linked patch changes the order in some {{if}} statements and migrates a few
> methods to static final fields.
> ||trunk|[branch|https://github.com/apache/cassandra/compare/trunk...snazy:boolean-hotspot]|[testall|http://cassci.datastax.com/view/Dev/view/snazy/job/snazy-boolean-hotspot-testall/lastSuccessfulBuild/]|[dtest|http://cassci.datastax.com/view/Dev/view/snazy/job/snazy-boolean-hotspot-dtest/lastSuccessfulBuild/]
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)