jeffheaton / encog-java-core

http://www.heatonresearch.com/encog
Other
743 stars 268 forks source link

Performance improvements #124

Closed mustajarvi closed 10 years ago

mustajarvi commented 11 years ago

Made three different optimizations:

  1. Micro optimizations of array reference access. Such optimizations should be used sparingly of course, but this loop seemed to be one of those places.
  2. I noticed that the number of worker threads were set using the number of processors + 1 rule. In this case I think it's more fitting to set the number of threads to being equal to the number of CPU:s since we can avoid some context switches that way and keep the data in the CPU caches longer.
  3. Replaced Math.tanh() with FastMath.tanh() from Apache Commons. This added a new dependency, but since it's quite possible it's useful in other places this shouldn't be so bad.
jeffheaton commented 11 years ago

Thankyou very much. I will take a look.

jeffheaton commented 10 years ago

Thank you for the changes. Finally merged this into Encog.