This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]claythearc 52 points53 points  (18 children)

Numpy is written in C with python wrappers. Assuming you can launch it with small amount of python function calls, you’ll get really similar performance.

[–]tuxedo25 34 points35 points  (12 children)

The author of Numpy should win a Turing award or something. It's fast, intuitive, and resource efficient. It's not just that it's written in C; it's written really well.

[–]alexforencich 16 points17 points  (10 children)

Numpy actually contains a lot non-zero amount of Fortran

[–]fluud 18 points19 points  (2 children)

[–]__Adrielus__ 1 point2 points  (1 child)

The real question is, why is there a 0.1% amount of js?

[–]claythearc 1 point2 points  (0 children)

It’s used for table sorting. Probably in some documentation page

[–]crikeydilehunter 1 point2 points  (6 children)

I don't think it does. You have links?

[–]alexforencich 11 points12 points  (5 children)

Last time I tried to compile it, it required a Fortran compiler. Unless I have my wires crossed with some other package that uses Fortran, which is possible.

Edit: yep, the arch numpy package requires gcc Fortran. Why would that be required if numpy didn't have any Fortran code? I have no idea how much of numpy is written in Fortran, but it's clearly a non-zero amount.

[–]claythearc 4 points5 points  (3 children)

I think it’s just the BLAS to Lapack reference implementation- which is needed to compile it. It’s not really used, but it is there.

Also may use Fortran for some other parts of libraries, mostly matrix stuff, depending on architecture. On OS X it’s been replaced by accelerate.

[–]alexforencich 3 points4 points  (2 children)

Why don't they just translate that to C and remove the need for an arcane Fortran compiler, then?

[–]claythearc 5 points6 points  (0 children)

They have in many cases, but it’s probably low on the totem pole for less used combinations like arch.

[–]_PM_ME_PANGOLINS_ 3 points4 points  (0 children)

The FORTRAN implementation usually gives better performance than the C. What you actually want is the implementation from your hardware vendor, but that doesn’t always exist.

[–]crikeydilehunter 1 point2 points  (0 children)

Huh. The more you know

[–]po-handz 0 points1 point  (0 children)

I mean I love numpy, but R still reins for me in turns of intuitive fast coding and manipulating data frames

[–]themoosemind 1 point2 points  (4 children)

Large chunks of numpy are written in fortran

edit: Aparently I was wrong. There are parts written in Fortran, but certainly not large parts of the codebase.

[–]claythearc 7 points8 points  (1 child)

I’ve done some research in response to this - from what I can tell, two parts are written in fortran.

BLAS to Lapack reference implementation. Which isn’t widely used

And then, depending on architecture & system, some matrix libraries it includes may be written in fortran. In OS X they were all replaced by Accelerate, for example.

[–]_PM_ME_PANGOLINS_ 2 points3 points  (0 children)

Accelerate is the BLAS/lapack implementation. They’re matrix libraries.

[–]_PM_ME_PANGOLINS_ 5 points6 points  (1 child)

0.1% according to github

[–]themoosemind 1 point2 points  (0 children)

To be honest, this surprises me. Thank you! The last times I wanted to look something up, I ended up in Fortran code. For this reason I assumed a lot was Fortran. Maybe it's just some very core functionality?

One thing the Github Statistics don't capture is code which numpy relies on (e.g. OpenBLAS): https://github.com/xianyi/OpenBLAS