Hello!

To see how J compares to other languages out there, I tried to implement
the spectral-norm [1] language benchmark in J. Part of my code [2] for
this looks like this:

    NB. entry at x,y of infinite matrix A
    A =: >:@:[ %@:+ -:@:(* >:)@:+
    NB. get the first y by y elements of A
    subA =: A"0 _~&i. M.

subA 5500 is called in the benchmark. In the beginning, my definition
for A looked like this:

    A =: >:@[ %@+ + -:@* >:@+

and was about five times slower than the definition above, even though
it computes the same values. Why is that the case?

Yours,
Robert Clausecker

[1]:
http://benchmarksgame.alioth.debian.org/u32/performance.php?test=spectralnorm

[2]:
https://gist.github.com/fuzxxl/ea936084dd5038cc4c06/c0db428c351af069332d456a2c5368c5fecb8d11


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to