First of all, let me dissolve a few misconceptions that you seem to have.
- Calling a library from another program will speed up your library.
No no no no no. This suggests that "driving a car at a given speed is slower than when using an F1 racer on a car with the same speed." It just doesn't make sense. When Python loads your library, it loads and processes it in the same way that the kernel loads and processes (in fact, the kernel does this in the case of Python). In fact, this “dual load” (which was not the original design for dynamic libraries) can slow down your library. I must emphasize that this is a tiny difference and should not concern the ordinary programmer.
- Cython Wraps Python C Code
This is not true. It compiles python code in C, which is then compiled into a dynamic library to load Python later. This can slightly improve your Python code and give you the ability to interact with atomic C data types using a small Python sauce. Although this is pretty cool, it does not give your code any “magic” abilities.
I would also like to add that some tests proved that Java (drum) is actually faster than C, C ++, Python and other languages, because the JVM is very optimized. This does not mean that you should use Java (because it has other problems), but it should give perspective.
source share