jblas-project / jblas

Linear Algebra for Java
http://jblas.org
BSD 3-Clause "New" or "Revised" License
590 stars 149 forks source link

FloatMatrix - toString is very slow #82

Open amachwe opened 7 years ago

amachwe commented 7 years ago

Firstly: Really like using JBLAS, thank you! Probably because of the String Formatting methods being used.

Using the toString on FloatMatrix is very slow. It is faster to call elementsAsList and then call the toString function.

Attached a performance test. FloatMatrixToString.zip

The difference is really significant especially if you are printing in a loop.

For my tests it takes approximately 10 times longer to call toString directly as compared to converting it to a list and calling to string on it.

mikiobraun commented 4 years ago

Hm, interesting, something to look into... .