Hi Jose, The performance issues I outlined a while back were largely due to repeated calls to getMetaData(). ColdBox 3 Final began caching that will helped dramatically. Also, when I moved from CF8 to CF9, it got even faster.
I guess lets start out by figuring out what version of ColdBox/WireBox you are on. (See our subject line conventions)
Also, in your example, is the “createOBject” and “new userBean” versions creating all the composite objects as well, or just the user object? Also, are you calling the init() methods after creation? If not, that’s not a fair comparison. Either way, how many times are you running those creates? Surely it isn’t taking 48 seconds for a single creation.
Also, what types of dependencies are you injecting? Are those singletons which are only created once, or are they transients. In my original post, all the dependencies were singletons so they were only created once, and then all other creations were just injected with a reference. I never inject transient beans directly. One reason is I like to wait to lazy load them when I actually need them, and secondly, that gives me more control over how they are created. I prefer to get all beans from an applicable service. Therefore, if a user has an address, I inject the addressService into my user, and when the user needs to lazy load an address, it asks the addressService to fetch it which allows me to encapsulate the logic of how to create and retrieve a user’s address. It would be much more difficult to autowire in a call to a service. (Which you CAN do, because WireBox is just that amazing but you can’t specify parameters.)
And lastly, while running your test, switch over to a tool like SeeFusion and pull some stack traces at random intervals and look for any code that continually is being executed to try and find the slow points. It could turn out to be code in your own init() method.