5 ms·
TL;DR: D is faster than Python.
by faragon 9y ago
TL;DR: D is faster than Python.
- gshulegaard 9y agoIs it though? Un-optimized Python vs. a D script iterated on 5 times? Certainly eye-catching but I wouldn't call it conclusive.
- faragon 9y agoSure, was for saving time. In my opinion, that article could be more elaborated.
- throwaway7645 9y agoNo, it isn't debatable which is generally faster (D), but I was impressed that you could just prototype in Python (probably significantly faster than D) and run it through PyPy when you're done and get 90% of the performance of D. Of course Python has the bloat of the interpreter and Jitter, while D is just a binary. Point is I was expecting more speed from D. I'm curious if this is just luck or the two would be neck and neck on a range of tests?
- gshulegaard 9y agoOptimizing/squeezing performance out of Python is a rabbit hole: https://www.ibm.com/developerworks/community/blogs/jfp/entry/A_Comparison_Of_C_Julia_Python_Numba_Cython_Scipy_and_BLAS_on_LU_Factorization?lang=en https://www.ibm.com/developerworks/community/blogs/jfp/entry... I would speculate using numba or Cython would yield further performance gains over PyPy...but that's mostly just based on anecdotal comparisons: https://cardinalpeak.com/blog/faster-python-with-cython-and-pypy-part-2/ https://cardinalpeak.com/blog/faster-python-with-cython-and-... I just think it is a bit dishonest to try and make a claim as pointed as this article's in 2017 by stopping at simply running an un-optimized CPython script with PyPy.
- throwaway7645 9y agoI think they're just giving you bounds on what to expect and not selling anything. The D optimizations looked a lot easier (write it slightly different) than mucking with Cython or Numba. Simply running through PyPy is another thing all together.
- gshulegaard 9y agoI don't know, a lot of benefit can be had from Cython by just declaring types and flagging for compilation: http://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html http://cython.readthedocs.io/en/latest/src/tutorial/cython_t... http://cython.readthedocs.io/en/latest/src/quickstart/cythonize.html http://cython.readthedocs.io/en/latest/src/quickstart/cython... But that is just my opinion.