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

Henri Biestro commented on JEXL-277:
------------------------------------

Changeset: bfa64f34a7a03e025e2ff7f4e458094ef349114c
Author:    henrib <[email protected]>
Date:      2020-02-26 18:23
Message:   JEXL-277: fast path basic arithmetic ops on primitive relative 
numbers (long, int, short...), check overflows

> Speedup arithmetic evaluations
> ------------------------------
>
>                 Key: JEXL-277
>                 URL: https://issues.apache.org/jira/browse/JEXL-277
>             Project: Commons JEXL
>          Issue Type: Improvement
>    Affects Versions: 3.1
>         Environment: The [PR 
> 15|https://github.com/apache/commons-jexl/pull/15] is prepared for this ticket
>            Reporter: Dmitri Blinov
>            Assignee: Henri Biestro
>            Priority: Minor
>             Fix For: 3.2
>
>
> As of now, Jexl inefficiently evaluates operators *+*, *-*, */*, *%*, *\** on 
> Integer and Long types as it casts operands to BigInteger type, applies 
> operation and casts the result back. This for example, creates 3 BigInteger 
> instances for a simple operation of 1+1. All evaluations on Integer types, 
> and in some cases, on Long types, can be performed on corresponding primitive 
> *long* values, which is a magnitute of 200%-300% faster, in my measurments, 
> and unneeded objects are not allocated on heap. Another point is to make 
> selfAssign operators *overridable* in descendands of JexlArithmetic, instead 
> of being able to be *oveloaded*, which can save the time by avoiding 
> reflection when using syntax like {code}x += 1{code}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to