4 ms·
Isn't a lot of numpy implemented in C?
by hesselink 12y ago
Isn't a lot of numpy implemented in C?
- chpatrick 12y agoSure, but the point is that you can get some pretty nice speeds without writing any C yourself.
- sampo 12y agoBut only for operations that someone else has written the C code for you. If you come up with some new algorithm that cannot be reduced to operations already implemented in C, then you would need to write the fast C implementation yourself.
- buster 12y agoPython is implemented in C as well and it's still a dynamic language, which was the point here, i guess.
- Dewie 12y agoThere is a large difference between "implemented in C" (presumably talking about the runtime being implemented in C) and "Python that calls C code". If the implementation of Python is implemented in C as an interpreter#, then the interpreter is almost sure to be slower than whatever language/technology the interpreter was implemented with/on top of. This is pretty orthogonal to "Python that is implemented in <whatever>, and is doing most of the calculations via calling a C library". If you have a Python program that computes over megabytes of data, but it is calling a C library to do the heavy lifting, then the performance of Python itself is probably going to be negligible if 99.9% of the time is spent on the computation in the C code. # Though could be a VM or something.
- pekk 12y agoSo what? Do you live in an alternative universe where you cannot use libraries implemented in C? Then you also cannot use, for example, Node.js (based on libuv).