• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class path matters?

 
Manjunath Hampanur
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if there are some paths which are invalid or it contains some jar files which are never used, will the performance during compilation and run time execution matters?

I have two similar Systems with different CLASSPATHs. They are taking different execution times for executing same program. This is consistently observed.

Is there any other factor which affects like this?

Thanks
Manjunath
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems reasonable that the number and order of items on the classpath could affect compiler execution time and application execution time, during the early stages where lots of classes are being loaded. How big that effect would be, I don't know and do not have time to experiment. Once most classes are loaded, its effect would be greatly reduced, tending towards zero.
 
Ashwath Rangan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Say there is a class A which is imported into B each time you compile B it would automatically compile A. And if we do not use A anywhere then its a waste of execution cycles.
But i am not sure abt the part of adding jars to class path. I guess it would not make a difference. May be i am wrong.
 
Joe Ess
Bartender
Pie
Posts: 9266
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Fire Bird:
Say there is a class A which is imported into B each time you compile B it would automatically compile A. And if we do not use A anywhere then its a waste of execution cycles.


Have a look at the javac documentation:

A successful type search may produce a class file, a source file, or both. Here is how javac handles each situation:

* Search produces a class file but no source file: javac uses the class file.

* Search produces a source file but no class file: javac compiles the source file and uses the resulting class file.

* Search produces both a source file and a class file: javac determines whether the class file is out of date. If the class file is out of date, javac recompiles the source file and uses the updated class file. Otherwise, javac just uses the class file.

javac considers a class file out of date only if it is older than the source file.


so A only gets compiled if it is out of date.
By the way Fire Bird, we have a naming policy you must have missed. In short, your displayed name must be a real-sounding first and last name. You can change your displayed name here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic