Tim Holloway wrote:Considering that a typical java app these days may end up referencing resources from a thousand different classes in dozens of different packages and that the entire core packageset is organized by function, not by frequency of use, it really wouldn't make sense for most classloaders to parse out package names and look up classes on that basis. More so when you realize that entries in a ZIP (JAR) file aren't actually physically organized by "directory", just stored with the item's pathname + attributes + contents.
So in short, I think you'll find most classloaders simple use the fully-qualfied classname (package+class) as a hash key, making the actual package name completely immaterial as far as retrieval speed goes.
But, in any event, listen to what Bill says. It can be a real bugger to macro-optimize a system that has been prematurely micro-optimized.