Python performance notes...

Courageous jkraska1 at san.rr.com
Tue May 23 18:15:25 CEST 2000


> You didn't INCREF your result.
> Call this function often enough, and your system will crash,
> since Py_None has an empty deallocator.

Interesting. I'm just learning embedding.

> Furthermore, I'd suggest to do a different test than the above.
> Empty loops don't happen in reality, and it makes limited
> sense to compare a Python loop against a compiler, which in
> this case even has the chance to optimize the full thing
> away.

Well, it didn't change it to i=i+100000, if that's
what you mean. What I was really testing was the
cost of the increment operation, establishing a worse
case. We already know that the best cases are better,
but doing the worse case allows us to compare to other
worse case situations, IMO. A friend of mine wanted
to know what the loop cost was, to compare it to TCL
as a watermark.

> The calling overhead of the objects in your code is still
> there, and unless you leave Python totally and use native
> C structures all the time, you will not gain much more
> than 30, maybe 40 percent of speed by avoiding the interpreter.

Well, that's interesting, any pointers which prove this,
or is this experience speaking?



C/



More information about the Python-list mailing list