On 5/10/05, Yan Hu <[EMAIL PROTECTED]> wrote:
> Hi:
> I have been playing with JSF lately.  I really like it since it is very 
> intuitive.  But as I
> understand it, JSF keeps a component tree for each page with JSF widgets in 
> it on the server. So
> it is heavy weight compared with struts. Could I safely say that struts-based 
> apps are a bit more
> performant than JSF ones? someone please shed some light on it.......
> 

As with everything in life, there are tradeoffs.  What you quoted
above is an example (but only matters if you choose client side state
saving; for server side the tree just sits in memory in the session
instead).  On the other hand, JSF does more for you that you have to
do by yourself in a Struts app (such as using a form bean, and then
having to do things like BeanUtils.copyProperties() in your action).

I've never done any exhaustive timings, but am pretty familiar with
the internal implementation of the Struts tags and the JSF RI code
(haven't looked deeply at the MyFaces implementation, but the JSF RI
code is not a useful predictor for the performance there):

* Rendering from Struts custom tags and corresponding JSF component tags
  - slightly more complexity in the JSF case.  (Rendering is more complex
  for more complex components, but that's functionality Struts doesn't have
  so it's not really something you can compare).

* Decoding of JSF components versus Struts ActionForm plus copying
  - slightly less complexity in the JSF case.

* Server side validation - roughly a push.

* Request processing lifecycle - roughly a push.

On the other hand, even if there turns out to be a non-trivial
difference, it's still unlikely that your users will perceive the
difference, unless CPU time on the machine running your servlet
container is your most important performance bottleneck.  That tends
not to be the case with web applications, where database and network
latencies tend to dominate.

Bottom line -- I would not use runtime performance as a decision point
for picking a web framework technology unless I knew I would be in a
CPU constrained environment.  Meeting functional requirements and
supporting easy, maintainable development are more important.

Craig McClanahan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to