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

Benedict commented on CASSANDRA-8988:
-------------------------------------

bq. find2: binaryBoundarySearch ('binary' lets people know its complexity and 
that it needs a sorted array immediately)

Boundary confuses me, whereas the argument Op makes it quite clear what you're 
asking for, and we would have to call it binaryBoundarySearchAsymmetric which 
is much too verbose. We could call it binarySearchAsymmetric() but I really 
don't think either this or compareAsymmetric offer more than compare2 since 
they have their type info to convey this information. Succinctness has its own 
rewards, and there is a tension between the two. That's my last statement on it 
though, since I don't feel dramatically strongly, and if you're still convinced 
I'll bow to your judgement.

bq. Might be worth renaming i, j to lower, upper as well.

Took me a while to figure out why this sentence confused me (and I think would 
make the code less clear): lower/higher already have a meaning in the Op, and 
it is different to the meaning you're ascribing here. By convention i <= j in 
algorithms (unless they span the same range, or a different dataset, in which 
case it is just an order of declaration), so it conveys the same information 
without any potential for confusion. Alternatively lb/ub are clearer (to me).

bq. inclusivei: acceptsEqual (or maybe lowerIncludesEqual). 'lt' could be 
called similarly (if (c < acceptEqual) is not the clearest line of code, but it 
does help understand what's going on).

How about strictnessOfLessThan? I don't think acceptsEqual is more descriptive 
than inclusivei, but {{if (c < strictnessOfLessThan)}} seems to convey the 
right meaning.

bq. returni: selectBoundary. 

That works for me.

> Optimise IntervalTree
> ---------------------
>
>                 Key: CASSANDRA-8988
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8988
>             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
(v6.3.4#6332)

Reply via email to