Survival of the fittest
Dieter Maurer
dieter at handshake.de
Thu Sep 28 16:48:21 EDT 2006
Thomas Bartkus <thomasbartkus at comcast.net> writes on Tue, 26 Sep 2006 22:06:56 -0500:
> ...
> We would be curious to know about those things you can do in C++
> but can't do in Python.
I implemented an incremental search engine in Python.
It worked fine for large quite specific "and" queries (it
was faster than a C implemented search engine).
However, for large "or" queries, it was by two orders of magnitude
slower then the C competitor.
I had to move my implementation to C. Now my search engine is
almost always (significantly) faster and when it is slower,
the difference is negligeable.
We learn: a C/C++ implementation can in some cases be drastically
more efficient than a Python one.
My special case was that almost all my data were integers
and the C implementation could exploit this fact -- unlike the Python one.
--
Dieter
More information about the Python-list
mailing list