Ok, I know my computations are not objective and so on, but anyway, I hate to wait so much time when performing my unit-tests:
My guice swing application takes about 7 seconds to initialize. It's a simple IRC client. At that moment, no connection are open, I even haven't called any java.io or java.net classes yet. I've tried to narrow down what exactly is wrong and I get that 5.8 seconds (average) are used by Guice in order to create the injector with the 2 modules I'm using (one normal module and one built with FactoryModuleBuilder
, installed within the original module).
When I remove all modules (so basically calling only and exactly Guice.createInjector()
), it still takes 3.5 seconds.
The version of Guice I use is the 3.0 rc2. My computer is certainly not the latest, but it is still not older than 3 years.
So how can I improve Guice's performance, if possible?
For reference, here's the main method I'm using, causing the 3.5 seconds. Subsequent calls take 0.01 second
public static void main(String[] args) {
long t = System.currentTimeMillis();
Injector injector = Guice.createInjector();
long t1 = System.currentTimeMillis();
System.out.println(((t1 - t)) / 1000.0);
}
And the result
3.578
Injector
with Guice.createInjector()
and no modules.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With