cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benedict (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-8988) Optimise IntervalTree
Date Thu, 19 Mar 2015 23:49:39 GMT


Benedict commented on CASSANDRA-8988:

There are a few possibilities for implementing the find method efficiently that I wasn't planning
to explore just yet, but since you've asked me to justify myself I've gone ahead and uploaded
what I think is probably about as efficient as we can manage (a very minor tweak in fact).

To justify the rationale of using the switch statement: If I were expecting a compiler to
optimise well, I would put money on the switch being faster than a field access (which any
enum method would amount to after inlining). This is because, in principle, the location of
the enum itself can be substituted in without having to suffer the indirection costs of field
access, and there is only one conditional expression to evaluate when the switch statement
has only two possible outcomes. A single branch on a value is typically very fast.

Since an improved implementation above either approach was really trivial, though, let's go
with that.

> Optimise IntervalTree
> ---------------------
>                 Key: CASSANDRA-8988
>                 URL:
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Benedict
>            Assignee: Benedict
>            Priority: Minor
>             Fix For: 3.0
>         Attachments: 8988.txt
> We perform a lot of unnecessary comparisons in IntervalTree.IntervalNode.searchInternal.

This message was sent by Atlassian JIRA

View raw message