From: Glenn S. <gle...@av...> - 2002-12-11 19:16:50
|
Thanks to Endre for the detail on what is expensive for exception handling. I think this stack trace shows that this code is much more expensive than i= t needs to be. How do I get this on the TODO list of things to fix in webmacro? "23" daemon prio=3D1 tid=3D0x0x847a990 nid=3D0xa6c waiting for monitor entr= y [b6fff000..b6fffae4] at java.lang.Throwable.fillInStackTrace(Native Method) at java.lang.Throwable.<init>(Throwable.java:195) at java.lang.Exception.<init>(Exception.java:41) at java.lang.NoSuchMethodException.<init>(NoSuchMethodException.java:32) at java.lang.Class.getConstructor0(Class.java:1769) at java.lang.Class.getConstructor(Class.java:1002) at org.webmacro.Context.addTool(Context.java:581) at org.webmacro.Context.access$000(Context.java:52) at org.webmacro.Context$SettingHandler.processSetting(Context.java:100) at org.webmacro.util.Settings.processListSetting(Settings.java:294) at org.webmacro.Context.loadTools(Context.java:113) at org.webmacro.Context.<init>(Context.java:85) at org.webmacro.engine.BuildContext.<init>(BuildContext.java:48) at org.webmacro.engine.WMTemplate.parse(WMTemplate.java:150) at org.webmacro.engine.WMTemplate.write(WMTemplate.java:208) at org.webmacro.directive.IncludeDirective.write(IncludeDirective.java:373) at org.webmacro.engine.Block.write(Block.java:132) at org.webmacro.engine.WMTemplate.write(WMTemplate.java:218) at org.webmacro.directive.IncludeDirective.write(IncludeDirective.java:373) at org.webmacro.engine.Block.write(Block.java:128) at org.webmacro.engine.WMTemplate.write(WMTemplate.java:218) at com.av.core.AVRequest.render(AVRequest.java:430) at com.av.addurl.AddURL.handle(AddURL.java:55) at sun.reflect.GeneratedMethodAccessor274.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp= l =2Ejava:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.av.core.AVServlet.dispatch(AVServlet.java:1687) at com.av.core.AVServlet.handleRequest(AVServlet.java:1388) at com.av.core.AVServlet.handleRequest(AVServlet.java:1107) at com.av.core.AVServlet.doGet(AVServlet.java:1482) at javax.servlet.http.HttpServlet.service(HttpServlet.java:102) at javax.servlet.http.HttpServlet.service(HttpServlet.java:83) at com.caucho.server.http.Invocation.service(Invocation.java:325) at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:121) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:239) at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:157) at com.caucho.server.TcpConnection.run(TcpConnection.java:140) at java.lang.Thread.run(Thread.java:536) -----Original Message----- From: Endre St=F8lsvik [mailto:web...@st...] Sent: Monday, December 09, 2002 6:02 AM To: kea...@na... Cc: gle...@av...; br...@qu...; web...@li... Subject: Re: [Webmacro-devel] unused Tools On Tue, 3 Dec 2002 kea...@na... wrote: | I've puzzled over this piece of code before. Apparently there is the | ability to pass parameters from the configuration to the tools constructor, | but AFAIK noone has ever used this. So it is kind of annoying that this | code always gets executed. | | I don't think there's a big hit with throwing and immediately catching th= e | exceptions, but all the diagnostic logging is annoying. I suppose it would | be cleaner to just check for the constructors directly and avoid trying t= o | invoke them if they don't exist. I could make this change if folks agree= =2E Throwing an Exception is _expensive_. Filling in the stack-trace takes ages. One should _never_ use Exception-throwing in the normal code-path. Exceptions are for .. yes .. exceptions. It should only be used in the "rare-case", not the "common-case". The VM must also handle the Exception blocks, by going in and out of the try-blocks (there is a "machine-code" for doing this). --=20 Mvh, Endre St=F8lsvik M[+47 93054050] F[+47 51625182] Developer @ CoreTrek AS - http://www.coretrek.com/ CoreTrek corporate portal / EIP - http://www.corelets.com/ |