You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Hlista, Brad" <bh...@vignette.com> on 2000/09/21 19:06:05 UTC

instantiation performance

in the 4.2.1 section of the JSP1.2 Spec PD1, the 
<jsp:useBean> is discussed.  

as i read this, generally an implementation should 
be calling 'new' for bean creation unless beanName is
given in <jsp:useBean>.  the alternative of using
Beans.instantiate() to create an instance 
is quite slow in comparison. (3.6 seconds for 10,000
bean instantiations vs. 3.6 seconds for 4,700,000 on
a dual pentium 550 (one processor being used))

is this a correct reading of the spec?

should it or has it been considered?

i'm not sure if this has been addressed.  i've looked
around and did not see a mention of it in the archives.

thanks,
brad

from the Spec:

5. If the object is not found in the specified scope; and the class
specified names a non-abstract
class that defines a public no-args constructor, then that class is
instantiated, and
the new object reference is associated the with the scripting variable and
with the
specified name in the specified scope using the appropriate scope dependent
association
mechanism (see PageContext). After this, step 7 is performed.
If the object is not found, and the class is either abstract, an interface,
or no public
no-args constructor is defined therein, then a
java.lang.InstantiationException shall occur. This completes the processing
of this useBean action.

6. If the object is not found in the specified scope; and beanName is given,
then the method
instantiate() of java.beans.Beans will be invoked with the ClassLoader of
the
Servlet object and the beanName as arguments. If the method succeeds, the
new object
reference is associated the with the scripting variable and with the
specified name in the
specified scope using the appropriate scope dependent association mechanism
(see
PageContext). After this, step 7 is performed.

7. If the jsp:useBean element has a non-empty body, the body is processed.
The variable
is initialized and available within the scope of the body. The text of the
body is treated as
elsewhere; if there is template text it will be passed through to the out
stream; scriptlets
and action tags will be evaluated. 

Re: instantiation performance

Posted by James Cook <ji...@iname.com>.
Can bean instantiation be supported through the use of object pools?

jim

----- Original Message ----- 
From: "Hlista, Brad" <bh...@vignette.com>
To: <to...@jakarta.apache.org>
Sent: Thursday, September 21, 2000 1:06 PM
Subject: <jsp:useBean> instantiation performance


> in the 4.2.1 section of the JSP1.2 Spec PD1, the 
> <jsp:useBean> is discussed.  
> 
> as i read this, generally an implementation should 
> be calling 'new' for bean creation unless beanName is
> given in <jsp:useBean>.  the alternative of using
> Beans.instantiate() to create an instance 
> is quite slow in comparison. (3.6 seconds for 10,000
> bean instantiations vs. 3.6 seconds for 4,700,000 on
> a dual pentium 550 (one processor being used))
> 
> is this a correct reading of the spec?
> 
> should it or has it been considered?
> 
> i'm not sure if this has been addressed.  i've looked
> around and did not see a mention of it in the archives.
> 
> thanks,
> brad
> 
> from the Spec:
> 
> 5. If the object is not found in the specified scope; and the class
> specified names a non-abstract
> class that defines a public no-args constructor, then that class is
> instantiated, and
> the new object reference is associated the with the scripting variable and
> with the
> specified name in the specified scope using the appropriate scope dependent
> association
> mechanism (see PageContext). After this, step 7 is performed.
> If the object is not found, and the class is either abstract, an interface,
> or no public
> no-args constructor is defined therein, then a
> java.lang.InstantiationException shall occur. This completes the processing
> of this useBean action.
> 
> 6. If the object is not found in the specified scope; and beanName is given,
> then the method
> instantiate() of java.beans.Beans will be invoked with the ClassLoader of
> the
> Servlet object and the beanName as arguments. If the method succeeds, the
> new object
> reference is associated the with the scripting variable and with the
> specified name in the
> specified scope using the appropriate scope dependent association mechanism
> (see
> PageContext). After this, step 7 is performed.
> 
> 7. If the jsp:useBean element has a non-empty body, the body is processed.
> The variable
> is initialized and available within the scope of the body. The text of the
> body is treated as
> elsewhere; if there is template text it will be passed through to the out
> stream; scriptlets
> and action tags will be evaluated. 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>