Specific performance question - Python vs. Java

Discussion in 'Python' started by reinsn, May 19, 2006.

  1. reinsn

    reinsn Guest

    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!
     
    reinsn, May 19, 2006
    #1
    1. Advertising

  2. 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
     
    Diez B. Roggisch, May 19, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Darren
    Replies:
    7
    Views:
    1,325
    Darren
    Jul 18, 2005
  2. =?Utf-8?B?SmF2?=

    Is ViwState Page-Specific or UserControl-Specific

    =?Utf-8?B?SmF2?=, Aug 16, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    557
    =?Utf-8?B?SmF2?=
    Aug 16, 2006
  3. Replies:
    2
    Views:
    367
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Feb 26, 2007
  4. mazdotnet
    Replies:
    2
    Views:
    419
    Alexey Smirnov
    Oct 2, 2009
  5. William FERRERES
    Replies:
    7
    Views:
    226
    William FERRERES
    Jul 9, 2007
Loading...

Share This Page