File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Static variables and performance....

 
Daniel Silva
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are some performance problem if I use static final variables and static methods into other class file and call this from a servlet ?
 
Frank Carver
Sheriff
Posts: 6920
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not especially.
Sure, there might be a (very slight) performance issue when the other class is first loaded, but only if is loaded from a remote location over a network, but that is really rare.
Much more likely is that the other class you are using may have lots of dependencies on yet other classes, even though the static method you are calling does not make use of them. This can lead to "code bloat", where a lot of unused classes need to be deployed with your application just to satisfy the compiler. I know of several "utilitiy" jars that have this problem.
Calling methods from other classes is generally a good thing, unless the other classes have taken on too many responsibilitie sand become bloated.
 
steve souza
Ranch Hand
Posts: 862
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both static and non-static method calls are VERY VERY VERY fast, and will make no practical difference.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic