Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Will inheritance affect performance?

  1. #1
    Member
    Join Date
    May 2011
    Posts
    61
    My Mood
    Busy
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Will inheritance affect performance?

    Hi, just curious, if I wanted to run time efficiency of BST (binary search tree) and AVL, would performance be affected b/c I wanted to build a BST class and an AVL class that extends BST (since AVL is just BST but with built-in feature to ensure it is height balanced). For instance, let's say I wanted to measure time taken to find an item after inserting 1million nodes for each instantiated class.


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Will inheritance affect performance?

    Most likely you won't notice it, and I doubt there is any difference at all in Java since everything (except primitives) extends the Object class.

    The best way to find out for sure is to try it out, but be careful how you benchmark since the Java runtime makes getting reliable bench-marking data quite difficult compared to statically compiled languages.

Similar Threads

  1. CPU Performance Software.
    By Mr.777 in forum Java Theory & Questions
    Replies: 11
    Last Post: September 30th, 2011, 01:10 AM
  2. Increasing performance of my graphics routines
    By willberg in forum AWT / Java Swing
    Replies: 6
    Last Post: November 16th, 2009, 01:41 PM
  3. Performance of Type Casting and Conversions
    By fritzoid in forum Java Theory & Questions
    Replies: 1
    Last Post: October 1st, 2009, 07:56 PM
  4. Cracking password in less number of Trials using brute forcea
    By xisstar in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 10th, 2009, 10:40 AM
  5. Replies: 1
    Last Post: May 13th, 2008, 08:08 AM