You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2014/07/19 23:29:39 UTC

[jira] [Comment Edited] (LUCENE-5837) Only check docsWithField when necessary in numeric comparators

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

Uwe Schindler edited comment on LUCENE-5837 at 7/19/14 9:28 PM:
----------------------------------------------------------------

bq. the goal was not to remove the null check, but the check for missing values.

In fact you are removing the null check, which is the extra branch to check for missing values - just look at the old code (this was my trick). It was done exactly like this to not slow down - hotspot can optimize that away, if it finds out that it is null - it does this very fast. We checked this at the time I added this to Lucene 3.5 or like that. We compared the two implementations - without missing values and the new one with missing values - and they were exactly the same speed. The same that Robert discovered here, too.

In fact your patch would only work in Lucene trunk, in 4.x this cannot be done like that.


was (Author: thetaphi):
bq. the goal was not to remove the null check, but the check for missing values.

In fact you are removing the null check, which is the extra branch to check for missing values - just look at the old code (this was my trick). It was done exactly like this to not slow down - hotspot can optimize that away, if it finds out that it is null - it does this very fast. We checked this at the time I added this to Lucene 3.5 or like that. We compared the two implementations and they were exactly the same speed. The same that Robert discovered here, too.

In fact your patch would only work in Lucene trunk, in 4.x this cannot be done like that.

> Only check docsWithField when necessary in numeric comparators
> --------------------------------------------------------------
>
>                 Key: LUCENE-5837
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5837
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Adrien Grand
>            Assignee: Adrien Grand
>            Priority: Minor
>             Fix For: 5.0, 4.10
>
>         Attachments: LUCENE-5837.patch, LUCENE-5837.patch
>
>
> Our numeric comparators have branches to deal with missing values. However there are some cases when checking docs that have a field is not useful:
>  - if all docs have a value
>  - if no docs have a value
>  - if the missing value is 0



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org