encog-java-core icon indicating copy to clipboard operation
encog-java-core copied to clipboard

Performance tip

Open PetrToman opened this issue 13 years ago • 2 comments

There is a number of places where manual array copy is done instead of using System.arraycopy(), which is much faster (the bigger the array, the faster: ~2x for m=10, ~15x for m=100, ~30x for m=1000). Here is a list of classes:

CloudPacket line 45 DeriveMinimum line 173 EigenvalueDecomposition line 117, 650, 767, 888 EngineArray line 102 FlatNetwork line 375, 416, 732 FlatNetworkRBF line 121 LUDecomposition line 208 Matrix line 272, 337, 389, 438, 592 MatrixMath line 88, 156 NelderMeadTraining line 178, 185, 255, 264, 282, 323, 342, 347, 392, 423 NormalizationStorageArray2D line 80 OutputErrorFunction line 30 PeekableInputStream line 91, 149 SVDTraining line 106

The conversion can be done automatically in IDEA (http://www.jetbrains.com/idea/). Just run Analyze / Inspect code and check for Performance issues / Manual array copy. (There is also a number of other reported issues you may look at.)

PetrToman avatar Apr 10 '12 13:04 PetrToman

Been meaning to check out IDEA, this will be a good excuse!

jeffheaton avatar May 02 '12 22:05 jeffheaton

I just opened two pull requests (109 and 110) that fix some of the issues above. I also noticed other bits of code that could easily be replaced with Arrays.copyOf() or Arrays.fill() and changed those as well. Any comments would be appreciated.

leanto avatar May 28 '12 22:05 leanto