On 10/03/2016 13:08, Chris Angelico wrote:
When people want better performance out of a number-crunching Python program, they have a few options. One is to rewrite their code in C or Fortran or something. Another is to make small tweaks so the bulk of the work is handled by numpy or Cython. A third is to keep their code completely unchanged, but run it under PyPy instead of whatever they were previously using (probably CPython). Generally, rewriting in C/Fortran is generally a bad idea; you pay the price over the whole application, when optimizing a small subset of it would give 99% of the performance improvement. That's why actual CPython byte-code interpretation performance isn't so critical; if we can change 5% of the code so it uses numpy, we keep 95% of it in idiomatic Python, while still having the bulk of the work done in Fortran. CPython has other priorities than performance - not to say that "slow is fine", but more that "slow and dynamic opens up possibilities that fast and static precludes, so we're happy to pay the price for the features we want". ChrisA
This should be the first option https://wiki.python.org/moin/PythonSpeed/PerformanceTips
-- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list