commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] [Commented] (MATH-894) Spurious method call in "ResizableDoubleArray" ("o.a.c.m.util")
Date Tue, 13 Nov 2012 15:30:12 GMT


Gilles commented on MATH-894:

bq. Removing the reallocation leaves the internal array at whatever size it was when clear
was invoked.

As it is now, it's a feature!
Previously, "clear" was, for all purposes, synonymous to creating a new object. And when it
comes to a user wanting to free resources, that's what he should do (creating a new object).

I think that keeping the size is more useful since it could spare a series of reallocation/copying
which might likely occur when the same array is reused (e.g. in a loop).

I'll update the Javadoc.

> Spurious method call in "ResizableDoubleArray" ("o.a.c.m.util")
> ---------------------------------------------------------------
>                 Key: MATH-894
>                 URL:
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.0
>            Reporter: Gilles
>            Assignee: Gilles
>            Priority: Minor
>             Fix For: 3.1
> Method "addElement" should not call "contract()", as it will almost always make the storage
array shrink on the first call since it will be considered "too big" (for just storing one
> See discussion about this change in MATH-757.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message