View Single Post
 
Old April 13th, 2007, 11:53 PM
englere englere is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: Atlanta, Georgia, USA.
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How many instances would you like, and how would you decide which one gets used? Besides, they share the same code, anyway. Only state (in the form of instance fields) is separated into class instances.

Static methods always perform better than instance methods, but it's hard to measure much difference unless you compare empty method calls. Instance methods aren't really copied, but they have to be accessed thru a virtual dispatch in most cases, which adds about 40% more overhead (when you compare the dispatch to empty methods that don't do anything). You can reduce the overhead by not marking them virtual, but that could impact your OOP model, especially if you had grand designs on what you wanted to do with instances.

Eric