You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Karl Trumstedt <ka...@gmail.com> on 2014/03/01 09:28:39 UTC

Possible performance enchancement?

Hello,

I've been looking and reading a lot about JSF's lifecycle. I'm no expert in
any sense and have not fully grasped what happens in each phase.

I have debugged our application and seen how much time is spent in each
cycle. For larger pages it can be quite a lot (500 ms for each APPLY,
VALIDATION, UPDATE). Even for smaller pages there can be ~10-20ms in the
cycle when posting to the server. As far as I have gathered, the component
tree is traversed for each of these cycles. For us, every ms counts :)

Now, my application doesn't use the JSF validation framework. There isn't
any <f:validator> stuff anywhere. For me, I don't see that I need to
execute that phase, ever. So I would like to turn of that phase. But even
better, maybe when parsing the XHTML facelet (or constructing the view or
something), couldn't the UIViewRoot have information on if there are any
<f:validator> stuff on the page? If not, it could skip the validation phase
completely?

As I said, I don't fully grasp what's happening behind the scenes so maybe
something else would stop working? And maybe the validation phase does more
the execute <f:validator> tags.

I realize this scenario might be special since we don't use the
<f:validator> stuff, we reuse our own legacy validation framework, but
there still could be pages in a regular JSF application with lots of
components (big tables etc) and no validation (or custom validation). Any
pointers for how I could patch and skip the validation phase myself would
be nice:)

Thanks

Re: Possible performance enchancement?

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

I doubt you can get a significant improvement, but anyway I think it
is possible to write a custom component extending for example from
UIPanel and override processValidations(...) method, so the validation
step is not propagated to the children. Then you put that component
wrapping the datatable, and the final result will be the datatable
will not be checked for validation.

regards,

Leonardo Uribe

2014-03-04 5:38 GMT-05:00 Gerhard Petracek <ge...@gmail.com>:
> you need the traversal anyway e.g. to convert the values (which is done
> during the same traversal).
> your numbers sound way too high -> imo you have a different issue in your
> application.
> -> we need more details about your setup.
>
> regards,
> gerhard
>
> http://www.irian.at
>
> Your JSF/JavaEE powerhouse -
> JavaEE Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
>
>
> 2014-03-04 11:20 GMT+01:00 Thomas Andraschko <an...@gmail.com>:
>
>> As the scenario is really special, what about overwriting the JSF
>> Lifecycle and modify it for your requirements?
>>
>>
>> 2014-03-01 9:28 GMT+01:00 Karl Trumstedt <ka...@gmail.com>:
>>
>>> Hello,
>>>
>>> I've been looking and reading a lot about JSF's lifecycle. I'm no expert
>>> in any sense and have not fully grasped what happens in each phase.
>>>
>>> I have debugged our application and seen how much time is spent in each
>>> cycle. For larger pages it can be quite a lot (500 ms for each APPLY,
>>> VALIDATION, UPDATE). Even for smaller pages there can be ~10-20ms in the
>>> cycle when posting to the server. As far as I have gathered, the component
>>> tree is traversed for each of these cycles. For us, every ms counts :)
>>>
>>> Now, my application doesn't use the JSF validation framework. There isn't
>>> any <f:validator> stuff anywhere. For me, I don't see that I need to execute
>>> that phase, ever. So I would like to turn of that phase. But even better,
>>> maybe when parsing the XHTML facelet (or constructing the view or
>>> something), couldn't the UIViewRoot have information on if there are any
>>> <f:validator> stuff on the page? If not, it could skip the validation phase
>>> completely?
>>>
>>> As I said, I don't fully grasp what's happening behind the scenes so
>>> maybe something else would stop working? And maybe the validation phase does
>>> more the execute <f:validator> tags.
>>>
>>> I realize this scenario might be special since we don't use the
>>> <f:validator> stuff, we reuse our own legacy validation framework, but there
>>> still could be pages in a regular JSF application with lots of components
>>> (big tables etc) and no validation (or custom validation). Any pointers for
>>> how I could patch and skip the validation phase myself would be nice:)
>>>
>>> Thanks
>>
>>
>

Re: Possible performance enchancement?

Posted by Gerhard Petracek <ge...@gmail.com>.
you need the traversal anyway e.g. to convert the values (which is done
during the same traversal).
your numbers sound way too high -> imo you have a different issue in your
application.
-> we need more details about your setup.

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2014-03-04 11:20 GMT+01:00 Thomas Andraschko <an...@gmail.com>:

> As the scenario is really special, what about overwriting the JSF
> Lifecycle and modify it for your requirements?
>
>
> 2014-03-01 9:28 GMT+01:00 Karl Trumstedt <ka...@gmail.com>:
>
> Hello,
>>
>> I've been looking and reading a lot about JSF's lifecycle. I'm no expert
>> in any sense and have not fully grasped what happens in each phase.
>>
>> I have debugged our application and seen how much time is spent in each
>> cycle. For larger pages it can be quite a lot (500 ms for each APPLY,
>> VALIDATION, UPDATE). Even for smaller pages there can be ~10-20ms in the
>> cycle when posting to the server. As far as I have gathered, the component
>> tree is traversed for each of these cycles. For us, every ms counts :)
>>
>> Now, my application doesn't use the JSF validation framework. There isn't
>> any <f:validator> stuff anywhere. For me, I don't see that I need to
>> execute that phase, ever. So I would like to turn of that phase. But even
>> better, maybe when parsing the XHTML facelet (or constructing the view or
>> something), couldn't the UIViewRoot have information on if there are any
>> <f:validator> stuff on the page? If not, it could skip the validation phase
>> completely?
>>
>> As I said, I don't fully grasp what's happening behind the scenes so
>> maybe something else would stop working? And maybe the validation phase
>> does more the execute <f:validator> tags.
>>
>> I realize this scenario might be special since we don't use the
>> <f:validator> stuff, we reuse our own legacy validation framework, but
>> there still could be pages in a regular JSF application with lots of
>> components (big tables etc) and no validation (or custom validation). Any
>> pointers for how I could patch and skip the validation phase myself would
>> be nice:)
>>
>> Thanks
>>
>
>

Re: Possible performance enchancement?

Posted by Thomas Andraschko <an...@gmail.com>.
As the scenario is really special, what about overwriting the JSF Lifecycle
and modify it for your requirements?


2014-03-01 9:28 GMT+01:00 Karl Trumstedt <ka...@gmail.com>:

> Hello,
>
> I've been looking and reading a lot about JSF's lifecycle. I'm no expert
> in any sense and have not fully grasped what happens in each phase.
>
> I have debugged our application and seen how much time is spent in each
> cycle. For larger pages it can be quite a lot (500 ms for each APPLY,
> VALIDATION, UPDATE). Even for smaller pages there can be ~10-20ms in the
> cycle when posting to the server. As far as I have gathered, the component
> tree is traversed for each of these cycles. For us, every ms counts :)
>
> Now, my application doesn't use the JSF validation framework. There isn't
> any <f:validator> stuff anywhere. For me, I don't see that I need to
> execute that phase, ever. So I would like to turn of that phase. But even
> better, maybe when parsing the XHTML facelet (or constructing the view or
> something), couldn't the UIViewRoot have information on if there are any
> <f:validator> stuff on the page? If not, it could skip the validation phase
> completely?
>
> As I said, I don't fully grasp what's happening behind the scenes so maybe
> something else would stop working? And maybe the validation phase does more
> the execute <f:validator> tags.
>
> I realize this scenario might be special since we don't use the
> <f:validator> stuff, we reuse our own legacy validation framework, but
> there still could be pages in a regular JSF application with lots of
> components (big tables etc) and no validation (or custom validation). Any
> pointers for how I could patch and skip the validation phase myself would
> be nice:)
>
> Thanks
>