Hi.

FTR: I don't agree with such changes when they obfuscate the code
for no measurable gain (until proven otherwise[1]).
If the class is used properly, the "manual" copying is a minute part of
usage duration; if not used properly (e.g. calling "create()" instead of
"withCache()" on an existing instance), the "saved" copying time will
be marginal wrt the lost time due to repeating the other (likely much
lengthier) computations.

Regards,
Gilles

[1] Through JMH benchmarks _on the use-case at hand_.

Le dim. 20 juin 2021 à 09:35, GitBox <g...@apache.org> a écrit :
>
>
> arturobernalg commented on a change in pull request #99:
> URL: https://github.com/apache/commons-numbers/pull/99#discussion_r654891918
>
>
>
> ##########
> File path: 
> commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/LogFactorial.java
> ##########
> @@ -62,9 +62,7 @@ private LogFactorial(int numValues,
>          }
>
>          // Copy available values.
> -        for (int i = beginCopy; i < endCopy; i++) {
> -            logFactorials[i] = cache[i];
> -        }
> +        if (endCopy - 2 >= 0) System.arraycopy(cache, beginCopy, 
> logFactorials, beginCopy, endCopy - 2);
>
> Review comment:
>        True. Changed. TY
>
> ##########
> File path: 
> commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/FactorialDouble.java
> ##########
> @@ -64,9 +64,7 @@ private FactorialDouble(int numValues,
>          }
>
>          // Copy available values.
> -        for (int i = beginCopy; i < endCopy; i++) {
> -            factorialsDouble[i] = cache[i];
> -        }
> +        if (endCopy - 2 >= 0) System.arraycopy(cache, beginCopy, 
> factorialsDouble, beginCopy, endCopy - 2);
>
> Review comment:
>        True. Changed. TY
>

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

Reply via email to