Hi Nate,
I'm not sure I agree with your statement that you would never ask
Ninject for 100,000 objects. While I might agree that if you are
using Ninject for mainly web applications then your statement would
hold true but what about the people who have adapted the IoC philosphy
to other domains? I've been using Ninject in my application for about
8 months now. The application is an edit and imputation console
program written in C#. Typically, edit and imputation involves taking
a household that has failed a set of rules and finding similar
households to impute data and make the original household pass. In
our domain, the original household is known as the fail and the
households we search for are known as donors. Donors have a state and
they have business logic associated with them. For instance, a donor
needs to be able to calculate the distance between itself and the fail
and it might also need to retain that distance as part of its state.
When trying to find a donor for a fail we may search tens of thousands
of households as donors. As you can hopefully see Donors are
transient objects and in our case we have to make millions (sometimes
tens of millions) of them. I use Ninject to reduce the complexity of
my program (it's tough enough understanding the algorithm without
bloating the code with a bazillion factories and new operators) and it
works extremely well (excellent job by the way!!) but I need to find a
way to reconcile the need for a large number of transient objects with
Ninject?
These objects are typically created in one line in the code and in one
small run 4,000,000+ objects of a particular type were created. When
I use Ninject there is a noticeable (one user reported 600 times
slower) performance hit. The performance hit happened on code that
had not been optimized at all and I had read about a performance bug
in v1 (which I am using) that may reduce the performance hit
dramatically but not entirely. However, I am gambling that the
difference will still be significant!
What are your thoughts on using a new operator in very specific places
to enhance performance? Are there other tricks one can take with
Ninject to enhance performance? I hope to switch over to v2 soon and
re-evalaute performance with that version of Ninject, but in the
meantime is there any interest in adding syntax similar to Autofac
that would allow someone to use lambda expressions to employ the new
operator to speed things along when a user does need a large number of
transient operators?
Thanks in advance