Any updates on this issue? Will there be a fix?
Igor Vaynberg <[email protected]> 02/10/2010 06:15 PM Please respond to [email protected] To [email protected] cc Subject Re: @SpringBean injection expensive - a bug? create a jira issue and a quickstart. thanks. -igor On Tue, Feb 9, 2010 at 11:34 AM, Nikita Tovstoles <[email protected]> wrote: > Wicket's SpringWebApplication is deprecated and the javadoc advocates > using @SpringBean to inject dependencies at component level. However, > that appears to be an expensive proposition: > > I have a listView component that renders a (new) ExternalLink subclass > per item. That subclass uses a service (a singleton spring bean) > injected via @SpringBean like so: > > @SpringBean > private MyService service; > > YourKit tells me that when the page is being rendered, 47%(!) of cpu > time is being spent constructing the subclass, specifically, > repeatedly calling: > org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(ListableBeanFactory, > Class) > > The above is getting called with vigor from > SpringBeanLocator.hashCode() --> getBeanName() --> > getBeanNameOfClass(). HashCode() is likely getting called most often > by AnnotProxyFieldValueFactory.cache during look-ups - which I am > guessing isn't intentional. Looks like a bug, no? > > If the above is a bug indeed, is the workaround to always specify a > 'name' with @SpringBean? > > Thoughts? > -nikita > +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------+-----------------+ > | > Name > | Time (ms) | Own Time (ms) | > +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------+-----------------+ > | +---com.castanealabs.gui.component.search.CategoryDataViewPanel$1.populateItem(Item) > > | 5,430 100 % | 50 | > | | > > | | | > | +---com.castanealabs.gui.component.search.ProductImageCell.<init>(String, > SiteId, IModel) > | 2,680 49 % | 20 | > | | | > > | | | > | | +---com.castanealabs.gui.embedded.ExternalSiteProductInfoLink.<init>(String, > SiteId, IModel) > | 2,660 49 % | 0 | > | | | > > | | | > | | +---com.castanealabs.gui.embedded.ExternalSiteProductInfoLink.<init>(String, > SiteId, IModel, IModel) > | 2,660 49 % | 0 | > | | | > > | | | > | | +---com.castanealabs.gui.embedded.TargetedExternalLink.<init>(String, > IModel, IModel, String) > | 2,570 47 % | 0 | > | | | | > > | | | > | | | +---org.apache.wicket.markup.html.link.ExternalLink.<init>(String, > IModel, IModel) > | 2,570 47 % | 0 | > | | | | > > | | | > | | | +---org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(ListableBeanFactory, > Class) | 2,570 47 % | > 0 | > | | | | > > | | | > | | | > +---org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(Class) > | 2,570 > 47 % | 0 | > | | | | > > | | | > | | | > +---org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(Class) > | 2,570 47 % | > 10 | > | | | | > > | | | > | | | > +---org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(Class, > boolean, boolean) | 2,560 47 % | > 0 | > | | | | > > | | | > | | | > +---org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(String, > RootBeanDefinition) | 2,460 > 45 % | 10 | > | | | | | > > | | | > | | | | > +---org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(String, > RootBeanDefinition, Class[]) | 2,420 45 % | > 100 | > | | | | | | > > | | | > | | | | | > +---org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(String, > RootBeanDefinition, Class[]) | 1,750 32 % | 0 | > | | | | | | | > > | | | > | | | | | | > +---org.springframework.util.ReflectionUtils.getAllDeclaredMethods(Class) > | > 1,490 27 % | 20 | > | | | | | | | | > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] Notice: This communication, including any attachments, is intended solely for the use of the individual or entity to which it is addressed. This communication may contain information that is protected from disclosure under State and/or Federal law. Please notify the sender immediately if you have received this communication in error and delete this email from your system. If you are not the intended recipient, you are requested not to disclose, copy, distribute or take any action in reliance on the contents of this information.
