Specific performance question - Python vs. Java

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • reinsn

    #1

    Specific performance question - Python vs. Java

    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!

  • Diez B. Roggisch

    #2
    Re: Specific performance question - Python vs. Java

    reinsn wrote:
    [color=blue]
    > 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?[/color]

    No, this is a misunderstandin g 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

    Comment

    Working...