You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Vic Cekvenich <vi...@baseBeans.com> on 2003/07/31 14:07:32 UTC

Reflection

http://www.theserverside.com/home/thread.jsp?thread_id=20655
A good paper on performance, but implies that Struts reflection is slow.

I disagree, but.. would not mind converting some of the Struts to CGLib, 
if there is a comiter who would review and integrate, should it come on 
agenda.

.V



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Re: Reflection

Posted by Chris Nokleberg <ch...@sixlegs.com>.
Craig R. McClanahan wrote:
> Hi Chris,
> 
> (I get an index out of bounds exception on that link ... :-)

FWIW looking at the logs I think you may have mistyped...

> That's good news!  The best place to get involved in BeanUtils, of course,
> is over on commons-dev, but there are lots of interested folks here too.

I won't have time to write any code in the next two weeks but I'll try
to put together an initial patch soon after that.

>> Certainly there is a lot that can be done to improve performance even
>> without changing the BeanUtils API at all. I do have in mind some more
>> radical changes but those can wait...for example there is not much need
>> for DynaBeans when you can dynamically generate real beans.
> 
> I'm interested in both kinds (evolution and revolution) of progress.

That's good to hear. Another example of something that would require API
changes is moving from static utility methods to instances. For example,
instead of:

  BeanUtils.copy(from, to); // I'm making this up

You might use

  BeanCopier bc = BeanCopier.create(fromClass, toClass);
  // time passes...
  bc.copy(from, to);

In most frameworks, the types of bean manipulations you will want to do
can be determined ahead of time. By holding direct references to the
relevant BeanCopier and other similar objects you can avoid a
synchronized cache lookup each time you need to do a copy.

Chris



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Re: Reflection

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 1 Aug 2003, Chris Nokleberg wrote:

> Date: Fri, 01 Aug 2003 09:59:31 -0700
> From: Chris Nokleberg <ch...@sixlegs.com>
> Reply-To: Struts Developers List <st...@jakarta.apache.org>
> To: struts-dev@jakarta.apache.org
> Subject: Re: Reflection
>
> Ted Husted wrote:
> > Gavin King, creator of Hibernate and an avid CGLIB user, isn't sure
> > whether CGLIB, as it stands, would be much help to BeanUtils. The
> > trick would be to get the CGLIB team interested in helping with
> > BeanUtils.  This would not only benefit the Struts JSP tags, but every
> > other application that uses the Commons BeanUtils.
>
> Hi, I'm one of the co-authors of CGLIB. It has actually been my plan to
> use CGLIB to improve the performance of BeanUtils for a while, see my
> blog entry at http://sixlegs.com/blog/java/blojsom-permalink-filter.html
>

Hi Chris,

(I get an index out of bounds exception on that link ... :-)

That's good news!  The best place to get involved in BeanUtils, of course,
is over on commons-dev, but there are lots of interested folks here too.

> Certainly there is a lot that can be done to improve performance even
> without changing the BeanUtils API at all. I do have in mind some more
> radical changes but those can wait...for example there is not much need
> for DynaBeans when you can dynamically generate real beans.
>

I'm interested in both kinds (evolution and revolution) of progress.

> FYI CGLIB in CVS is now about 165K including all dependencies. You could
> strip that down a little bit if you didn't want all the proxy stuff.
>
> Craig R. McClanahan wrote:
> > The quality of your container's JSP page compiler is very critically
> > important.  For example, the change from Jasper 1 to Jasper 2 in
> > Tomcat (around 4.1.18 or so) resulted in page rendering time
> > improvements of 600% to 800% (enough to be visible even in a single
> > user environment on a fast machine), running exactly the same Struts
> > based application.
>
> A little plug...my company is also developing a high-performance JSP 2.0
> engine for scriptless pages which uses CGLIB to compile EL expressions,
> optimize taglibs, and avoid the need for javac at deployment (it
> compiles directly to byte-code, no Java source is involved).

Sounds like a very interesting project.

>
> Cheers,
> Chris

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Re: Reflection

Posted by Chris Nokleberg <ch...@sixlegs.com>.
Ted Husted wrote:
> Gavin King, creator of Hibernate and an avid CGLIB user, isn't sure
> whether CGLIB, as it stands, would be much help to BeanUtils. The
> trick would be to get the CGLIB team interested in helping with
> BeanUtils.  This would not only benefit the Struts JSP tags, but every
> other application that uses the Commons BeanUtils.

Hi, I'm one of the co-authors of CGLIB. It has actually been my plan to
use CGLIB to improve the performance of BeanUtils for a while, see my
blog entry at http://sixlegs.com/blog/java/blojsom-permalink-filter.html

Certainly there is a lot that can be done to improve performance even
without changing the BeanUtils API at all. I do have in mind some more
radical changes but those can wait...for example there is not much need
for DynaBeans when you can dynamically generate real beans.

FYI CGLIB in CVS is now about 165K including all dependencies. You could
strip that down a little bit if you didn't want all the proxy stuff.

Craig R. McClanahan wrote:
> The quality of your container's JSP page compiler is very critically
> important.  For example, the change from Jasper 1 to Jasper 2 in
> Tomcat (around 4.1.18 or so) resulted in page rendering time
> improvements of 600% to 800% (enough to be visible even in a single
> user environment on a fast machine), running exactly the same Struts
> based application.

A little plug...my company is also developing a high-performance JSP 2.0
engine for scriptless pages which uses CGLIB to compile EL expressions,
optimize taglibs, and avoid the need for javac at deployment (it
compiles directly to byte-code, no Java source is involved).

Cheers,
Chris



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Re: Reflection

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 1 Aug 2003, Ted Husted wrote:

> Date: Fri, 01 Aug 2003 06:43:32 -0400
> From: Ted Husted <hu...@apache.org>
> Reply-To: Struts Developers List <st...@jakarta.apache.org>
> To: Struts Developers List <st...@jakarta.apache.org>
> Subject: Re: Reflection
>
> The framework itself only uses reflection to transfer the request
> parameters to ActionForm properties. When people say "Struts uses
> reflection heavily", they usually mean creating output pages with the
> the custom tags. (It would be interesting to see such benchmarks run
> against Struts applications that use XLST or Velocity templates instead,
> or the Struts EL tags on a container optimized for JSTL.)
>

The quality of your container's JSP page compiler is very critically
important.  For example, the change from Jasper 1 to Jasper 2 in Tomcat
(around 4.1.18 or so) resulted in page rendering time improvements of 600%
to 800% (enough to be visible even in a single user environment on a fast
machine), running exactly the same Struts based application.

> The Struts JSP tags rely on the BeanUtils package. BeanUtils has become
> quite rich, and it is possible that it could be due for some
> optimization. BeanUtils also supports some very complex syntaxes that
> not everyone uses, and a BeanUtils "light" might also be a worthwhile
> idea, for people who are not using nested beans and so forth.

It's definitely worth looking at optimizations of BeanUtils -- I did some
on the original code, but there's been lots of things added since.

>
> Gavin King, creator of Hibernate and an avid CGLIB user, isn't sure
> whether CGLIB, as it stands, would be much help to BeanUtils. The trick
> would be to get the CGLIB team interested in helping with BeanUtils.
> This would not only benefit the Struts JSP tags, but every other
> application that uses the Commons BeanUtils.

+1

>
> -Ted.
>

Craig

> Vic Cekvenich wrote:
>  > http://www.theserverside.com/home/thread.jsp?thread_id=20655
>  > A good paper on performance, but implies that Struts reflection is slow.
>  >
>  > I disagree, but.. would not mind converting some of the Struts to CGLib,
>  > if there is a comiter who would review and integrate, should it come on
>  > agenda.
>  >
>  > .V
>  >
>  >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
>  > For additional commands, e-mail: struts-dev-help@jakarta.apache.org
>  >
>  >
>
>
> --
> Ted Husted,
>     Junit in Action  - <http://www.manning.com/massol/>,
>     Struts in Action - <http://husted.com/struts/book.html>,
>     JSP Site Design  - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Re: Reflection

Posted by Ted Husted <hu...@apache.org>.
The framework itself only uses reflection to transfer the request
parameters to ActionForm properties. When people say "Struts uses
reflection heavily", they usually mean creating output pages with the
the custom tags. (It would be interesting to see such benchmarks run
against Struts applications that use XLST or Velocity templates instead,
or the Struts EL tags on a container optimized for JSTL.)

The Struts JSP tags rely on the BeanUtils package. BeanUtils has become
quite rich, and it is possible that it could be due for some
optimization. BeanUtils also supports some very complex syntaxes that
not everyone uses, and a BeanUtils "light" might also be a worthwhile
idea, for people who are not using nested beans and so forth.

Gavin King, creator of Hibernate and an avid CGLIB user, isn't sure
whether CGLIB, as it stands, would be much help to BeanUtils. The trick
would be to get the CGLIB team interested in helping with BeanUtils.
This would not only benefit the Struts JSP tags, but every other
application that uses the Commons BeanUtils.

-Ted.

Vic Cekvenich wrote:
 > http://www.theserverside.com/home/thread.jsp?thread_id=20655
 > A good paper on performance, but implies that Struts reflection is slow.
 >
 > I disagree, but.. would not mind converting some of the Struts to CGLib,
 > if there is a comiter who would review and integrate, should it come on
 > agenda.
 >
 > .V
 >
 >
 >
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
 > For additional commands, e-mail: struts-dev-help@jakarta.apache.org
 >
 >


-- 
Ted Husted,
    Junit in Action  - <http://www.manning.com/massol/>,
    Struts in Action - <http://husted.com/struts/book.html>,
    JSP Site Design  - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org