Did you do any tests? That's the only relevant thing here. I'm simply saying that I don't know which is faster. I know for sure that (appart from performance) there are problems with static includes. It takes more maintenance .... Just another point of view: Now if the overhead of calling a dynamic include is <wildGuess> 0.1 ms </wildGuess>. It takes 36.000.000 calls for 1 hour CPU time. Now just like saying 'memory is cheap', I can say computer time is cheap compared to developer's time. If it takes a developer 1 hour extra development in the total development of the project, it takes a lot of hits before that extra time is paid back. If we're talking about very small overhead (in the order < 1ms) you should generally choose the most convenient solution.
just my opinion Geert Van Damme > -----Original Message----- > From: A mailing list about Java Server Pages specification and reference > [mailto:[EMAIL PROTECTED]]On Behalf Of Zvika Markfeld > Sent: vrijdag 11 januari 2002 17:43 > To: [EMAIL PROTECTED] > Subject: Re: <%! %> (was RE: I want to make code shorter.) > > > I think Shrikant's argument would be more relevant in more cases than > Geert's. Let's do some calculation: > A typical header + footer may include 5K of content, which might be > translated into 10K of servlet compiled code. > I don't know exactly what the overhead for loading classes into memory is, > but let's assume that these 10K are multiplied by two as loaded > into JVM and > an instance is created of their encompassing servlet. So now we're talking > about 20K, multiplied by 200 pages gives us 4000KB, or 4MB. > If this calculation is correct, I think that as long as your Servlet > Container is not running on an extremely low resource machine that is also > functioning as your app. server AND DB server, it would be reasonable to > assume that static includes are generally more efficient. Also, do bear in > mind that if you want to share information between the two pages via > JavaBeans, using dynamic includes would necessarily mean generating more > <jsp:useBean> related calls, whereas in static include these would not be > needed as the two pages whare the same declarative scope. > zm. > > > -----Original Message----- > From: A mailing list about Java Server Pages specification and reference > [mailto:[EMAIL PROTECTED]]On Behalf Of ShriKant Vashishtha > Sent: Thursday, January 10, 2002 4:09 PM > To: [EMAIL PROTECTED] > Subject: Re: <%! %> (was RE: I want to make code shorter.) > > > I think that memory is much cheaper these days compared to dynamic > performance. > In my view, inlining does improve performance always in all languages > unless it > involves complex logic. Compile time processing is always faster than a > function call, as function call is an always overhead. Sometimes for the > performance improvement we repeat a particular code if required instead of > calling a function again and again. Instead of creating same Object again > and > again we use static final, in turn use inlining. > > ~Namaste~(I bow to the devine in you) > -ShriKant > > A mailing list about Java Server Pages specification and reference wrote: > > > > I don't think that we need to use dynamic include everywhere. Most of > the > > > times > > > we should try to use the static include only for the performance > > > reasons as > > > that block or file is included at the compilation time only and JSP > > engine > > > does > > > not have to include the block at the request time. If the resource is > > > dynamic, > > > dynamice include acts on a request and sends back a result that > > > is included > > > in > > > the JSP page and then only JSP container resumes the processing of JSP > > > page. > > > > Did you try this out? > > I'm not sure that dynamic includes are slower. In fact they > might even be > > faster than static includes. > > The web container doesn't do a real http request to itself for every > > dynamic > > include! It can optimize the chain of servlets a request goes through. > All > > the overhead of starting a thread, accepting and parsing the http > commands > > and parameters, all the network stuff is only done once. The only extra > > thing involved in a dynamic include is a function call to the service > > method > > of a servlet. > > Static includes OTOH are linked in at compile time. This means that the > > same > > lines of code (HTML of java) are copied in every generated servlet that > > uses > > the include. Since a servlet instance remains in memory, it also means > that > > your include code is kept x times in memory. > > Lets give the example of a footer.jsp with some address info and stuff. > > It's > > normal that you include that in every page. This could mean that the > > address > > information is kept in Ram memory maybe 200 times. I really think that > > could > > harm performance. > > > > Geert Van Damme > > > > > ================================================================== > ========= > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff > > JSP-INTEREST". > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST > > DIGEST". > > Some relevant FAQs on JSP/Servlets can be found at: > > > > http://archives.java.sun.com/jsp-interest.html > > http://java.sun.com/products/jsp/faq.html > > http://www.esperanto.org.nz/jsp/jspfaq.jsp > > http://www.jguru.com/faq/index.jsp > > http://www.jspinsider.com > > ================================================================== > ========= > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff > JSP-INTEREST". > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST > DIGEST". > Some relevant FAQs on JSP/Servlets can be found at: > > http://archives.java.sun.com/jsp-interest.html > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.jsp > http://www.jguru.com/faq/index.jsp > http://www.jspinsider.com > > ================================================================== > ========= > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff > JSP-INTEREST". > For digest: mailto [EMAIL PROTECTED] with body: "set > JSP-INTEREST DIGEST". > Some relevant FAQs on JSP/Servlets can be found at: > > http://archives.java.sun.com/jsp-interest.html > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.jsp > http://www.jguru.com/faq/index.jsp > http://www.jspinsider.com > =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
