[weld-dev] @New beans

Stuart Douglas stuart.w.douglas at gmail.com
Sat Nov 13 18:44:34 EST 2010


After doing some more profiling I think we can massively reduce startup time for a large number of beans. 

At the moment we add an @New bean for every managed bean, while according to the spec I think this is only necessary for beans that are actually injected into an @New injection point. I performed a quick test where I removed the @New beans (and skipped the tests) and in the 5000 bean case it reduced the AS startup time form 90s to 60s (this is actually a 50% speedup as the AS takes 30s to start with a 5000 class deployment without weld), and reduces the memory usage by a further 20Mb (bringing the total saving so far to 100Mb). This speedup will probably be less for smaller deployment, because parts of the startup process are O(n^2) on the number of beans (in particular TypeSafeResolver.findMatching).

Is my interpretation of the spec correct? The spec actually says that these @New beans that do not match an injection point still exist but are disabled, which as far as I can tell is the same as just not creating them. 


Stuart


More information about the weld-dev mailing list