Wirebox dependency / speed efficiency

Hi there… I am hoping one of you guys can resolve a debate ongoing in my office.

We are currently using Machii framework and are going to be using wirebox to manage our dependencies.

It is not possible to integrate some of the Machii components (listeners,filters,plugins) into the wirebox config .

however… within these components we can inject our dependencies (services) from our wirebox instance we are planning to load into the application scope.

Example

Currently in our listener we instantiate a new instance of a component like so in our configure method

variables.objUtilityListener = new code.model.UtillityService();

If we moved to getting it from our application wirebox instance would this give us any performance increase?

variables.objUtilityListener = application.wirebox.getinstance(“UtilityService”);

I think it will… however other developers think no performance increase will be achieved.

Thanks very much guys!!

The only way the second method will give you any performance increase, is if it is a singleton and not a transient. But if it is not a heavy site, it will be a marginal performance increase.

Thanks very much.

I have another question…

If I have a Service component which references session variables in its initialisation method.

EXAMPLE

lets say that the value of session.strSessionVariable = ‘test’

variables.strSessionVariable= session.strSessionVariable; return this; return variables.strSessionVariable; return session.strSessionVariable;

In my example… if a set this component to be a singleton in my wirebox application instance.
Every time I grab an instance of the object from wirebox the returned value from returnSessionVariable method will be “test” even if the session variable changes after wirebox is initialised.
However what would the second method return.

Please excuse my ignorance!

The second method as in returnSessionVariableDirect, will return what ever is in the session at the time of that method being called.