470,841 Members | 905 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,841 developers. It's quick & easy.

Built-in datatypes speed

Hello Python-List

I hope somebody can help me with this. I spent some time googling for an
answer, but due to the nature of the problem lots of unrelevant stuff
shows up.

Anyway, I reimplemented parts of TigerSearch (
http://www.ims.uni-stuttgart.de/proj...R/TIGERSearch/ ) in Python.
I am currently writing the paper that goes along with this
reimplementation. Part of the paper deals with the
differences/similarities in the original Java implementation and my
reimplementation. In order to superficially evaluate differences in
speed, I used this paper (
http://www.ubka.uni-karlsruhe.de/cgi...000/5&format=1
) as a reference. Now, this is not about speed differences between Java
and Python, mind you, but about the speed built-in datatypes
(dictionaries, lists etc.) run at. As far as I understood it from the
articles and books I read, any method call from these objects run nearly
at C-speed (I use this due to lack of a better term), since these parts
are implemented in C. Now the question is:

a) Is this true?
b) Is there a correct term for C-speed and what is it?

I would greatly appreciate an answer to that, since this has some impact
on the argumentation in the paper.

Thanks,

MaŽl

PS: For people interested in this reimplementation project: my code will
be published here (
http://www.ling.su.se/dali/downloads...gner/index.htm ) as soon as
it is integrated with the GUI and properly tested. The whole thing is
GPLed...
Feb 7 '07 #1
1 1318
On Feb 7, 2:34 am, MaŽl Benjamin Mettler <mbmett...@access.unizh.ch>
wrote:
Anyway, I reimplemented parts of TigerSearch (http://www.ims.uni-stuttgart.de/proj...R/TIGERSearch/) in Python.
I am currently writing the paper that goes along with this
reimplementation. Part of the paper deals with the
differences/similarities in the original Java implementation and my
reimplementation. In order to superficially evaluate differences in
speed, I used this paper (http://www.ubka.uni-karlsruhe.de/cgi...t=ira/2000/5&f...
) as a reference. Now, this is not about speed differences between Java
and Python, mind you, but about the speed built-in datatypes
(dictionaries, lists etc.) run at. As far as I understood it from the
articles and books I read, any method call from these objects run nearly
at C-speed (I use this due to lack of a better term), since these parts
are implemented in C. Now the question is:

a) Is this true?
b) Is there a correct term for C-speed and what is it?
I think the statement is highly misleading. It is true that most of
the underlying operations on native data types are implemented in c.
If the operations themselves are expensive, they could run close to
the speed of a suitably generic c implementation of, say, a
hashtable. But with richer data types, you run good chances of
landing back in pythonland, e.g. via __hash__, __equals__, etc.

Also, method dispatch to c is relatively slow. A loop such as:

lst = []
for i in xrange(int(10e6)):
lst.append(i)

will spend most of its time in method dispatch and iterating, and very
little in the "guts" of append().

Those guts, mind, will be quick.

-Mike
Feb 9 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Andrew Crook | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.