Re: Performance of matrix arithmetic in Raku

[email protected] (Timo Paulssen) Tue, 9 Feb 2021 02:50:48 +0100
Newsgroups perl.perl6.language
Message-ID <[email protected]>
Hi,

raku doesn't have matrix operations built into the language, so you're=20
probably refering to modules out of the ecosystem?

Math::Matrix seems to have everything implemented in pure raku, which=20
you should not expect to outperform pure python without some=20
optimization work.

Math::libgsl::Matrix is a NativeCall wrapper around the gnu scientific=20
library, which you would expect to be fast whenever big tasks can be=20
implemented as a single call into the library, and a bit slower whenever=20
data has to go back and forth between raku and the library, though=20
without measuring first, I can't say anything about the actual=20
performance numbers.

It would be quite important to see whether the "python performance of=20
matrix arithmetic" refers to NumPy, which i think has most of its code=20
implemented in fortran, which i would naively expect to outperform code=20
written in C.

Other than that, there's of course the @ operator in python which just=20
does matrix multiplication i think? You would have to look at CPython to=20
see how that is implemented.

On top of that, you'll of course also have to try the code in question=20
with PyPy, which is very good at making python code go fast, and perhaps=20
with Cython?

Hope this doesn't add too many more questions, and actually answers a=20
thing or two?
 =C2=A0 - Timo

On 09/02/2021 02:18, Parrot Raiser wrote:
> There's a post online comparing Python's performance of matrix
> arithmetic to C, indicating that Python's performance was 100x (yes, 2
> orders of magnitude) slower than C's.
>
> If I understand it correctly, matrix modules in Raku call GNU code
> written in C to perform the actual work.
>
> Does that make Raku significantly faster for matrix work, which is a
> large part of many contemporary applications, such as AI and video
> manipulation? If it does, that could be a big selling point.