google-code-export / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
2 stars 1 forks source link

Optimize Injector Creation Performance #363

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
We need to measure and optimize Guice 2 injector creation.

Original issue reported on code.google.com by limpbizkit on 27 Apr 2009 at 6:26

GoogleCodeExporter commented 9 years ago
You've done an awesome job on this already. I would add one area where we can 
make a marginal 
improvement:

Detect disjoint singleton chains and allow them to be constructed in parallel. 
Currently, we take a lock on 
Injector.class for constructing singletons. This is pretty bad. Firstly we only 
need to take a lock per injector 
tree (i.e. all child injectors must lock on the same lock as the root 
injector), this helps disjoint injector trees 
live in the same process in parallel (or, live happily in the forest =).

Secondly, we can apply the same principle to singleton object graphs that are 
disjoint. This allows multiple 
threads to run concurrently in the same injector tree (for example, creating + 
starting n number of rpc 
servers).

Original comment by dha...@gmail.com on 27 Jun 2009 at 2:17

GoogleCodeExporter commented 9 years ago

Original comment by sberlin on 22 Feb 2011 at 1:52