Google Guice Performance ?

612 views
Skip to first unread message

Satish Pokhrel

unread,
Feb 5, 2013, 1:19:45 AM2/5/13
to google...@googlegroups.com
Hello Everyone,

Yesterday, i tested injecting field and constructors using google guice after checking with yourKit Java Profiler i found that CPU usages and memory suddenly rises ( Actually i am injecting fields and constructor of swing components ). For reference i have pasted injected code please have a look http://pastie.org/6050852

P.S I am new to Google Guice, If i am incorrect or getting wrong then please correct me :)

Best Regards,

Satish

Reinhard Nägele

unread,
Feb 5, 2013, 1:30:40 AM2/5/13
to google...@googlegroups.com
Remove the @Inject annotations from the fields. You are combining field and constructor injection thus making Guice do the injection twice. I'd suggest you make the fields final then.

Reinhard

Satish Pokhrel

unread,
Feb 5, 2013, 1:33:12 AM2/5/13
to google...@googlegroups.com
Thanks brother, Cheers !! Actually i want to reuse Object of IndexContainer class, OptionContainer class and SearchContainer class, for doing that should i have to bind or create the Module or can be ok with this only ?

Cédric Beust ♔

unread,
Feb 5, 2013, 1:58:14 AM2/5/13
to google...@googlegroups.com

On Mon, Feb 4, 2013 at 10:30 PM, Reinhard Nägele <reinhard...@mgm-tp.com> wrote:
Remove the @Inject annotations from the fields. You are combining field and constructor injection thus making Guice do the injection twice.

I find it hard to believe that this would make a significant difference since Guice has to look up these fields anyway (if only to find out whether they have an @Inject annotation).

Just speculating though, happy to be proven wrong and to learn something about Guice along the way.

Satish: you didn't say exactly where YourKit was saying that the spike was coming from, do you have more specific results to share?

-- 
Cédric

Satish Pokhrel

unread,
Feb 5, 2013, 3:56:35 AM2/5/13
to google...@googlegroups.com, ced...@beust.com

Than you guys ! This group is absolutely  amazing, every members are supportive here. Sure, i can be more specific if you want, like i have clearly made an difference with using Guice and creating objects inside the constructor. I have upload an screenshot please have a look

Nicolas Antoniazzi

unread,
Feb 6, 2013, 3:39:04 PM2/6/13
to google...@googlegroups.com, ced...@beust.com
Wow,

I am using setter injection to inject my services and dao in my web application.
Recently, I have seen that my cpu load increased quite significantly.
I will check if it can come from this. I thought that it was quite a light procedure (traverse @inject methods and inject members)... But obviously not

Thanks for this thread,

Nicolas.


2013/2/5 Satish Pokhrel <relstu...@gmail.com>

Than you guys ! This group is absolutely  amazing, every members are supportive here. Sure, i can be more specific if you want, like i have clearly made an difference with using Guice and creating objects inside the constructor. I have upload an screenshot please have a look

--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice...@googlegroups.com.
To post to this group, send email to google...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages