Speed Isse: importing vs. declaration in code
Is it more efficient to have for example java.io.FileReader myReader in the code as opposed to importing it at the top of the program? I am trying to speed up a GUI application and was wondering how to speed up the startup time of my program.
[249 byte] By [
seanmu13a] at [2007-11-27 11:35:42]

imports dont effect "performance" or "efficiency".
> imports dont effect "performance" or "efficiency".
Definitely not with respect to runtime. It *may* have affect at compile-time, but it's not likely to be noticeable.
~
But if i took out all of the import statements and explicitly named the classes each time I needed to would that improve startup time at all?
> But if i took out all of the import statements and
> explicitly named the classes each time I needed to
> would that improve startup time at all?
No. There is no difference at runtime.
~
> But if i took out all of the import statements and
> explicitly named the classes each time I needed to
> would that improve startup time at all?
No.
Importing has ZERO effect at runtime. The generated bytecode will be exactly the same whether you import *, import named classes, or import nothing.
All importing does is save you typing and make your clode less cluttered by telling the compiler that when you say, e.g., "List", you mean "java.util.List."
jverda at 2007-7-29 17:04:23 >

Alright, thanks everybody. Do you have any tips on improving GUI start time that you'd like to share? Thanks
maybe a better question would be, "what can one do to decrease start-up time?"
edit - too slow
I remember being told about an office building were there were complaints
about the waiting time for elevators. The cost of putting in another elevator
was huge, so they came up with an alternate plan: they installed mirrors
by the elevators.
Yea, load JFileChooser in the background before you ever have to use it.
On Windows it takes FOREVER to pop-up the first time.
> I remember being told about an office building were
> there were complaints
> about the waiting time for elevators. The cost of
> putting in another elevator
> was huge, so they came up with an alternate plan:
> they installed mirrors
> by the elevators.
Priceless.
~
i dont get it, lol.
people spent the time looking at themselves?
or did they spend all their time trying to press the buttons
reflected in the mirrors? ;)
In other words, why not add a splash screen :-)
so people press the buttons on the splash screen?
but why would someone hold a mirror to their screen?
<slaps item="head" target="desktop"/>
> so people press the buttons on the splash screen?
> but why would someone hold a mirror to their screen?
screens are like people, they tend to forget about time when they're admiring themselves and grooming their hair.