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

Robert Muir commented on LUCENE-8574:
-------------------------------------

+1, I remember jack added this explicitly to prevent the situation where the 
same subexpr gets called multiple times for the same document and it wastefully 
recomputes the whole thing more than once.

> ExpressionFunctionValues should cache per-hit value
> ---------------------------------------------------
>
>                 Key: LUCENE-8574
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8574
>             Project: Lucene - Core
>          Issue Type: Bug
>    Affects Versions: 7.5, master (8.0)
>            Reporter: Michael McCandless
>            Priority: Major
>
> The original version of {{ExpressionFunctionValues}} had a simple per-hit 
> cache, so that nested expressions that reference the same common variable 
> would compute the value for that variable the first time it was referenced 
> and then use that cached value for all subsequent invocations, within one 
> hit.  I think it was accidentally removed in LUCENE-7609?
> This is quite important if you have non-trivial expressions that reference 
> the same variable multiple times.
> E.g. if I have these expressions:
> {noformat}
> x = c + d
> c = b + 2 
> d = b * 2{noformat}
> Then evaluating x should only cause b's value to be computed once (for a 
> given hit), but today it's computed twice.  The problem is combinatoric if b 
> then references another variable multiple times, etc.
> I think to fix this we just need to restore the per-hit cache?
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to