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.
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.