SciRuby / nmatrix

Dense and sparse linear algebra library for Ruby via SciRuby
Other
469 stars 133 forks source link

Avoid unnecessary heap allocation of SLICE objects #542

Closed wlevine closed 8 years ago

wlevine commented 8 years ago

This partly fixes #541. Here are the results of Lokesh's benchmark with the patch:

       user     system      total        real
Matrix getter  1.960000   0.000000   1.960000 (  1.961916)
NMatrix getter  1.570000   0.000000   1.570000 (  1.583510)
Matrix setter  1.680000   0.000000   1.680000 (  1.688569)
NMatrix setter  3.070000   0.000000   3.070000 (  3.077533)

#[] is probably fast enough now. #[]= is a lot faster than before, but may still need more work.

@mohawkjohn I think this is the right way to do this, but I'd appreciate it if you take a look.

v0dro commented 8 years ago

Why are the tests failing?

translunar commented 8 years ago

@v0dro Looks like the failures relate to #522 and #538, or at least resemble those. I can't see how any of @wlevine's changes would have caused this, though — can you?

v0dro commented 8 years ago

@mohawkjohn I think you're right. Those other bugs will need fixing for the build to pass.

translunar commented 8 years ago

@wlevine Can you please rebase against master? I think we've fixed the Travis problems.

wlevine commented 8 years ago

@mohawkjohn Done!