On 10 Nov 2010, at 21:59, Paul Bakker wrote:
It's not easy to drop because it's part of the CDI spec I
guess. But besides that I don't think it's a conceptual problem, it has a lot of
advantages (injecting third party classes for example). In some cases (when startup times
are important, e.g. on GAE) it would be nice to override this behavior though.
Agreed, Ales has started prototyping this in Weld already :-)
The XML module in Seam 3 might be useful for declaring components,
and all other components should be left untouched. A Java class would be even better for
this (no XML parser overhead).
This is a big step back in the programming model, but makes Weld useable in situations
that startup times and memory usage are very important.
This discussion has actually changed course somewhat, from talking about memory usage to
startup time -- the blog I wrote concentrates only on memory usage. There are lots of ways
to improve startup time. The biggest overhead we have observed is actually loading the
classes to scan in the first place, followed by the scan. We can use a project such as
jandex to improve both of these significantly, by generating all the metadata about the
classes as part of the build, and storing it in the deployed jar. This should have a major
effect on a runtime env like GAE which has to go through startup much more often.
In fact, I want to take this one step further for Weld 1.1 and offer a full "partial
startup" mode, whereby the environment can say to Weld "I've already scanned
all the classes, built up all the metadata about annotations, meta-annotations etc. and
called all of the ProcessAnnotatedType events, and applied modifications from them back,
here is the set of AnnotatedTypes from which to generate beans". Obviously very
useful in something like GAE which needs to cold-start much more often (my crude estimate
is this could save say 60% of startup time without us doing any optimisation on startup
time, something I hope Stale can look at once he has worked on runtime performance). This
will also be very useful in JBoss AS 7 which will offer the ability to build parts of the
deployment on the domain controller before handing it off to the individual servers.