• Post Reply Bookmark Topic Watch Topic
  • New Topic

does packaging impact on performance?  RSS feed

 
Alim Atar
Ranch Hand
Posts: 102
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Just a basic question about package, except modularity(making beautiful code) and security is there any impact of packaging on performace?
I mean in terms loading class etc whatever way is there any impact on performance interms of cpu consumtion,memory / byte code size(i mean number of instruction statements of class),total execution time of code?


Reagrds,
Alim
 
Paul Clapham
Sheriff
Posts: 22375
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Packaging?

I assume you aren't asking about whether it makes a difference whether you put shrink-wrap plastic around the CD which the product is distributed on. But what are you asking about?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Code should be placed in packages for ease of maintenance and documentation.

For fun, do a google search for "premature optimization is the root of all evil"

Bill
 
Tim Holloway
Bartender
Posts: 18663
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Alim Atar
Ranch Hand
Posts: 102
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks lot for your answers, i aggree with you Tim.
I know it was littile bit silly question but i asked more over curiosity point of view.
In fact i verfied it with javap utility and found that it uses fully-qualfied classname and number of instruction statements are same with and without package.



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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good work checking the actual operation AND reporting it back to the forum. Now this thread will be useful in the future (if and only if the user thinks to do a search first)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!