Python and the need for speed
bc at freeuk.com
Wed Apr 19 06:33:12 EDT 2017
On 19/04/2017 01:07, Erik wrote:
> On 19/04/17 00:33, bartc wrote:
[Talking about an interpreter that is /not/ for Python]
>> With the sort of lower level programs I write (in another dynamic
>> language not Python), such an assembly layer improved performance 2-3
>> times over using 100% HLL compiled using C and gcc-O3.
> Did you give the C compiler enough hints though?
If writing native C then I can spend a lot of time tweaking different
things, and probably I could get a worthwhile improvement. But I doubt
it would be double the speed.
But I anyway generate the C code from another language and I don't want
it tied to a particular compiler or be full of specific pragmas and
such, unless necessary. I don't need to because I can always bring out
the asm version! [However that only works on Win64 platform. I use C for
> Also, remember that -O3 might (and by that I mean probably will! ;))
> make your code larger. If you have some specific core areas of your
> interpreter that are now large enough to cause instruction cache misses
> then a smaller -O2 (or even -Os) compiled version might perform better
> on your hardware.
My interpreter is on github as /one/ C source file (a link would be
inappropriate here). People can compile it with -O3 or -O2 if they wish.
It's a bit simpler than building CPython, and OS-neutral; that was
More information about the Python-list