[
https://issues.apache.org/jira/browse/MATH-1389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15562539#comment-15562539
]
Emmanuel Bourg commented on MATH-1389:
--------------------------------------
Thank you for the benchmark Christoph. I turned it into a JMH benchmark and the
execution time was very similar once the JVM has warmed up (I tested on a Core
2 Duo E8400 3GHz with Java 8u91 on Windows).
With the current Commons Math master I got:
{code}
Benchmark (size) Mode Cnt Score Error Units
MatrixBenchmark.submatrix 1 avgt 5 118,914 2,302 us/op
MatrixBenchmark.submatrix 2 avgt 5 147,029 2,388 us/op
MatrixBenchmark.submatrix 5 avgt 5 244,722 2,705 us/op
MatrixBenchmark.submatrix 10 avgt 5 466,465 4,090 us/op
MatrixBenchmark.submatrix 20 avgt 5 1058,738 10,147 us/op
MatrixBenchmark.submatrix 30 avgt 5 2450,626 25,935 us/op
MatrixBenchmark.submatrix 40 avgt 5 4121,504 35,984 us/op
{code}
And with your patch:
{code}
Benchmark (size) Mode Cnt Score Error Units
MatrixBenchmark.submatrix 1 avgt 5 112,929 1,169 us/op
MatrixBenchmark.submatrix 2 avgt 5 146,797 0,968 us/op
MatrixBenchmark.submatrix 5 avgt 5 259,948 73,247 us/op
MatrixBenchmark.submatrix 10 avgt 5 468,226 48,748 us/op
MatrixBenchmark.submatrix 20 avgt 5 1087,570 22,342 us/op
MatrixBenchmark.submatrix 30 avgt 5 2301,979 20,295 us/op
MatrixBenchmark.submatrix 40 avgt 5 4043,559 62,592 us/op
{code}
> Runtime Improvement for getSubMatrix in Array2DRowRealMatrix
> ------------------------------------------------------------
>
> Key: MATH-1389
> URL: https://issues.apache.org/jira/browse/MATH-1389
> Project: Commons Math
> Issue Type: Improvement
> Reporter: Christoph Dibak
> Priority: Trivial
> Attachments: 0001-faster-getSubMatrix-for-Array2DRowRealMatrix.patch,
> RuntimeTestGetSubMatrix.java
>
>
> Using System.arraycopy() for creating sub-matrices in the getSubMatrix()
> method of Array2DRowRealMatrix improves the runtime. Tested for a matrix
> with dimension 50x50, the execution time was 16 times faster.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)