commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Dibak <christoph.di...@ipvs.uni-stuttgart.de>
Subject Re: [math] Faster getSubMatrix in Array2DRowRealMatrix
Date Mon, 10 Oct 2016 10:11:47 GMT

Hi Emmanuel,

On 10/10/2016 10:25 AM, Emmanuel Bourg wrote:
> Do you know if using System.arraycopy is always faster than the
> current method, or is there a threshold where it becomes slower?

I checked different sizes of the sub-matrices and attached the code for
the evaluation to the bug report. Worst-case scenario for the patched
version is if every System.arraycopy only copies one double value.

Without Patch (first row is size of sub-matrix, second time):

10  33,996 ns
20  77,418 ns
30 157,778 ns
40 194,868 ns
worst-case 10,543 ns

With Patch:

10  5,362 ns
20  7,885 ns
30  9,926 ns
40 10,860 ns
worst-case 9,341 ns

In any case, also for the worst-case scenario, the patched version is
faster.  For bigger matrices, the speedup should increase.

Regards,
Christoph


Mime
View raw message