By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,569 Members | 1,422 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,569 IT Pros & Developers. It's quick & easy.

Specific performance question - Python vs. Java

P: n/a
Hi,

I have got a specific question on performance: Is the overhead of
object creation in Python lower than in Java? I mean, I would argue, in
Java by object creation, the complete class is the model and all
methods and attributes are generated for the object.
In Python, methods and objects are only generated, if reached: so could
this represent a performance advantage for Python?

Thanks!

May 19 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
reinsn wrote:
Hi,

I have got a specific question on performance: Is the overhead of
object creation in Python lower than in Java? I mean, I would argue, in
Java by object creation, the complete class is the model and all
methods and attributes are generated for the object.
In Python, methods and objects are only generated, if reached: so could
this represent a performance advantage for Python?


No, this is a misunderstanding on your side. In all OO-languages, the code
(methods) are separated from the instance. Thus creating an object results
in memory allocation _only_ for the members of that object, not any
methods! In python, this boils down to a dictionary holding the members,
JAVA/C++ allocate whatever the class makes them to.

So, no, no performance advantage.

Diez
May 19 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.