How to make Python run as fast (or faster) than Julia

Dan Stromberg drsalists at gmail.com
Fri Feb 23 19:45:38 EST 2018


On Fri, Feb 23, 2018 at 1:32 PM, bartc <bc at freeuk.com> wrote:
> On 23/02/2018 20:12, Chris Angelico wrote:
> So I'll keep it generic. Let's say the Tiny C compiler is not taken
> seriously because it might be a couple of times slower than gcc-O3, even
> thought it's 1% of the size and compiles 1000% as fast.

What's generic about a specific example?  (that's rhetorical)

I've used tcc in preference to gcc before; I had an application where
performance didn't matter as much as security; tcc has buffer overrun
checking.

> But the difference in runtime speed between Python and other dynamic
> languages, if you look at benchmarks doing actual work in the language, can
> be much greater than two times, yet that doesn't appear to matter.

The best way to use Python is to:
1) Write your whole application in it.
2) IF things are too slow, profile the app.  Usually performance will
be fast enough from the start, but not always.
3) After (if) identifying a hotspot, optimize it in any of a variety
of ways, while still reaping the benefits of rapid development (which
often matters much more than CPU speed today)

I have a page about speeding up python:
http://stromberg.dnsalias.org/~strombrg/speeding-python/

But again, those techniques are only infrequently relevant, and pretty
much never relevant to an entire application.



More information about the Python-list mailing list