You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mark Galbreath <ma...@qat.com> on 2003/05/23 22:05:01 UTC

Reflection in Struts

is used extensively.  My (granted, meager) understanding of Java class
interaction and life-cycle is that reflection is second only to
instantiation in resource use.  I haven't seen any discussion of this as a
limiting factor of using Struts in a high-volume environment.  Your
thoughts?

mark the instigator



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


Re: Reflection in Struts

Posted by Joe Germuska <Jo...@Germuska.com>.
At 16:05 -0400 5/23/03, Mark Galbreath wrote:
>is used extensively.  My (granted, meager) understanding of Java class
>interaction and life-cycle is that reflection is second only to
>instantiation in resource use.  I haven't seen any discussion of this as a
>limiting factor of using Struts in a high-volume environment.  Your
>thoughts?

Reflection performance has been steadily improving with each major 
version of Java.

You probably wouldn't want to use a lot of reflection with real-time 
systems.  What are you thinking of as high-volume?

Think of it this way.  Reflection is one of the things that makes 
developing in Struts so easy.  If nothing else, consider Struts a 
tool for RAD/prototyping, and optimize later if you find that it 
doesn't meet your performance needs.  Code that's easy to read and 
write usually isn't high performance, and vice-versa.  So it goes.

Joe

-- 
--
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"If nature worked that way, the universe would crash all the time." 
	--Jaron Lanier

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


RE: Reflection in Struts

Posted by Mark Galbreath <ma...@qat.com>.
Ahhh...no fair!  This is a subject you should tackle in your next book!\

Mark

-----Original Message-----
From: Ted Husted [mailto:husted@apache.org] 
Sent: Friday, May 23, 2003 4:47 PM
To: Struts Users Mailing List
Subject: Re: Reflection in Struts


There's this:

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg14397.html

Mark Galbreath wrote:
> Would you recommend a book/doc that covers this?  The literature I 
> have (and I have an extensive library) all agree on my original 
> premise.
> 
> mark
> 
> -----Original Message-----
> From: Ted Husted [mailto:husted@apache.org]
> Sent: Friday, May 23, 2003 4:26 PM
> 
> Reflection was a hog when it was first introduced, but it's been
> steadily optimized ever since. In JVM 1.4, it is quite efficient, and 
> probably more efficient that having to swap in and out a bunch of custom 
> code that did the same thing.
> 


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



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



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


Re: Reflection in Struts

Posted by Ted Husted <hu...@apache.org>.
There's this:

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg14397.html

Mark Galbreath wrote:
> Would you recommend a book/doc that covers this?  The literature I have (and
> I have an extensive library) all agree on my original premise.
> 
> mark
> 
> -----Original Message-----
> From: Ted Husted [mailto:husted@apache.org] 
> Sent: Friday, May 23, 2003 4:26 PM
> 
> Reflection was a hog when it was first introduced, but it's been 
> steadily optimized ever since. In JVM 1.4, it is quite efficient, and 
> probably more efficient that having to swap in and out a bunch of custom 
> code that did the same thing.
> 


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



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


RE: Reflection in Struts

Posted by Mark Galbreath <ma...@qat.com>.
Would you recommend a book/doc that covers this?  The literature I have (and
I have an extensive library) all agree on my original premise.

mark

-----Original Message-----
From: Ted Husted [mailto:husted@apache.org] 
Sent: Friday, May 23, 2003 4:26 PM

Reflection was a hog when it was first introduced, but it's been 
steadily optimized ever since. In JVM 1.4, it is quite efficient, and 
probably more efficient that having to swap in and out a bunch of custom 
code that did the same thing.



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


RE: Reflection in Struts

Posted by Mark Galbreath <ma...@qat.com>.
Ahhh...this is the age-old issue of "memory-efficient" vs. "let the hardware
take care of it."  Ted, you know as well as I do that this promote sloppy
programming.  I know assembly-language (forget about the machine-language
guys!) guys who could code anything we write into 10-E1 space.  I know the
compilers have gotten much better, but I think it results in more sloppy
code by programmers who don't know a damn thing about memory management.

Of course, that's just my onion...I could be wrong.
mark

-----Original Message-----
From: Ted Husted [mailto:husted@apache.org] 
Sent: Friday, May 23, 2003 4:46 PM
To: Struts Users Mailing List
Subject: Re: Reflection in Struts


The argument is that object creates are now so cheap that we don't need 
to avoid them by using multithreaded singletons, and to go all the 
trouble of making Actions thread-safe. It's not a quick patch, but it is 
something that we would want to look at for Struts 2.0.

Mark Galbreath wrote:
> I'd be interested in an explication of this. (seriously)
> 
> mark
> 
> -----Original Message-----
> From: Ted Husted [mailto:husted@apache.org]
> Sent: Friday, May 23, 2003 4:26 PM
> 
> People are now complaining that it's pointless for Struts to use the 
> singleton model for Actions. =:>
> 
> -Ted


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



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



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


Re: Reflection in Struts

Posted by Ted Husted <hu...@apache.org>.
The argument is that object creates are now so cheap that we don't need 
to avoid them by using multithreaded singletons, and to go all the 
trouble of making Actions thread-safe. It's not a quick patch, but it is 
something that we would want to look at for Struts 2.0.

Mark Galbreath wrote:
> I'd be interested in an explication of this. (seriously)
> 
> mark
> 
> -----Original Message-----
> From: Ted Husted [mailto:husted@apache.org] 
> Sent: Friday, May 23, 2003 4:26 PM
> 
> People are now complaining that it's pointless for Struts to use the
> singleton model for Actions. =:>
> 
> -Ted


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



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


RE: Reflection in Struts

Posted by Mark Galbreath <ma...@qat.com>.
I'd be interested in an explication of this. (seriously)

mark

-----Original Message-----
From: Ted Husted [mailto:husted@apache.org] 
Sent: Friday, May 23, 2003 4:26 PM

People are now complaining that it's pointless for Struts to use the
singleton model for Actions. =:>

-Ted



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


RE: Reflection in Struts

Posted by Mark Galbreath <ma...@qat.com>.
Wow!  That's an eye-opener. Thanks, Ted.

-----Original Message-----
From: Ted Husted [mailto:husted@apache.org] 
Sent: Friday, May 23, 2003 4:26 PM
To: Struts Users Mailing List
Subject: Re: Reflection in Struts


Mark Galbreath wrote:
 > is used extensively.  My (granted, meager) understanding of Java class  >
interaction and life-cycle is that reflection is second only to  >
instantiation in resource use.  I haven't seen any discussion of this  > as
a limiting factor of using Struts in a high-volume environment.  > Your
thoughts?

Reflection was a hog when it was first introduced, but it's been 
steadily optimized ever since. In JVM 1.4, it is quite efficient, and 
probably more efficient that having to swap in and out a bunch of custom 
code that did the same thing.

For more about whether Struts is performance, see

http://husted.com/struts/resources/performant.htm

And, instantiation isn't what it used to be either. It's usually cheaper 
to create than to cache now. People are now complaining that it's 
pointless for Struts to use the singleton model for Actions. =:>

-Ted.


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



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



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


Re: Reflection in Struts

Posted by Ted Husted <hu...@apache.org>.
Mark Galbreath wrote:
 > is used extensively.  My (granted, meager) understanding of Java class
 > interaction and life-cycle is that reflection is second only to
 > instantiation in resource use.  I haven't seen any discussion of this
 > as a limiting factor of using Struts in a high-volume environment.
 > Your thoughts?

Reflection was a hog when it was first introduced, but it's been 
steadily optimized ever since. In JVM 1.4, it is quite efficient, and 
probably more efficient that having to swap in and out a bunch of custom 
code that did the same thing.

For more about whether Struts is performance, see

http://husted.com/struts/resources/performant.htm

And, instantiation isn't what it used to be either. It's usually cheaper 
to create than to cache now. People are now complaining that it's 
pointless for Struts to use the singleton model for Actions. =:>

-Ted.


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>



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