Comment by mlochbaum
4 years ago
Yes, definitely a quick and dirty benchmark (I did test after I posted to see if initializing a does anything; it didn't). Timings for J below, since I think it's the most focused on linear algebra. The remarkable thing about the K code from the article is that it's all made from totally general-purpose pieces that have nothing to do with matrix products, and K interpreters don't have any clue what a matrix product is. In J the matrix product is written +/ .* with the generalized dot product operator . (which does need the preceding space, oof) and handled by specialized code. Given that, I found this measurement a little disappointing: about as fast as my C code in the 100x100 case and slightly faster in the 200x200 case.
a =: ?100 100$0
<.1e6 * 1000 (6!:2) '+/ .*~ a'
269
a =: ?200 200$0
<.1e6 * 1000 (6!:2) '+/ .*~ a'
1796
No comments yet
Contribute on Hacker News ↗