• Post Reply Bookmark Topic Watch Topic
  • New Topic

Does a heavy classpath affect performance?

 
Giriraj Bhojak
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a small project in my workspace with small number of jars on the classpath.
I need to use a class that exists in a larger project with a heavy classpath.
Hence now logically i need to add that project to the build path as well as as runtime classpath.

But I need to know whether this would result in a performance hit since now the classpath for my smaller project has suddenly got huge just because I need to use a class from the bigger project.

Is my question making any sense?

Thanks,
Giriraj.
 
Peter Johnson
author
Bartender
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There will be a slight performance hit during app startup as the JVM hunts for the classes to load. But once the needed classes are loaded, there should be no further performance degradation due to the larger classpath. Note that only the classes needed by the app get loaded, no classes that are not used will be loaded.

One thing you could try is to determine exactly which JARs need to be in the classpath - you will probably not need every JAR for the heavy app. A tool such a JBoss Tattletale can help you define this abbreviated classpath.
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Giriraj Bhojak wrote:
Hence now logically i need to add that project to the build path as well as as runtime classpath.


Or pull that one class out and use it independently of the larger project.
 
Giriraj Bhojak
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Peter.
I'll give a shot to Tattletale.
Looks promising.
 
Giriraj Bhojak
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Joe,

Did you mean i should add the class i need to a new but smaller project?

Thanks,
Giriraj.
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Giriraj Bhojak wrote:
Did you mean i should add the class i need to a new but smaller project?


I either have the build script to get the dependency out of source control and build it as a separate jar file or simply add it to the source directory of the project I'm working on.
The important thing is to have source control so you can reproduce a build with a particular version of the dependency. If the other project makes substantial changes to your dependency, you could ether end up with a broken dependency or miss out on valuable bug fixes.
 
Giriraj Bhojak
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That resolves my question.

Thanks Joe.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!