myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leonardo Uribe <lu4...@gmail.com>
Subject Re: [GSOC] State saving status after first improvements
Date Thu, 22 Jul 2010 16:43:27 GMT
Hi Marius

2010/7/22 Marius Petoi <marius.petoi@codebeat.ro>

> Hello,
>
> So, for MyFaces, the state sizes of the basic components are:
>
> - without partial state saving:
>     - HtmlOutputLabel: 760 B
>     - HtmlInputText: 582 B
>     - HtmlCommandButton: 1057 B
>     - UIDebug: 606 B
>     - HtmlDataTable: 1275 B (regardless of the number of lines the table
> has)
>     - UIColumn: 524 B
>     - HtmlInputText in table: 1176 B
>     - HtmlOutputText in table: 663 B
>
> - with partial state saving, after a submit has been done:
>     - HtmlInputText: 351 B (including the InputText components in the
> table)
>
> Using Leonardo's patch from the issue
> https://issues.apache.org/jira/browse/MYFACES-2616, for a table with 1000
> lines that contains 2 columns: one with input elements and the other with
> output components, the size of the saved state is 158000 B. Also, the state
> for the input component is 340 B. My suggestion would be (and I don't know
> what that implies) that state attributes common for all rows (such as the
> valid attribute, which is present in the state saved for all rows) to be
> saved directly as state of the child component. This is the only way I can
> think of to reduce the state of the UIData component.
>
>
Unfortunately, try to save the state directly on the child components is not
possible. The problem is the datatable is the one who know about the rows,
so the right place for save this information (at least the delta
information) is there. But the initial state could be saved on the children
if some additional methods are provided. I don't know if it is worth to add
those methods, because the only one interested to save the initial state is
the datatable (things are different if the children could use that
information to "reset" the current state, maybe a method called
resetInitialState). My first solution for partial state saving used a
protected variable to save the initial state on the children, but after look
the latest solution I'm inclined to implement the latest one.

regards,

Leonardo


> Regards,
> Marius
>
>
> On Wed, Jul 21, 2010 at 7:51 PM, Leonardo Uribe <lu4242@gmail.com> wrote:
>
>> Hi Marius, Martin
>>
>> Yes, it is a bug. The problem is related to some changes done on
>> MYFACES-2754. I think that this changes was tested against jsp but not
>> against facelets. I reverted the changes so you can test now.
>>
>> regards,
>>
>> Leonardo Uribe
>>
>> 2010/7/21 Martin Marinschek <mmarinschek@apache.org>
>>
>> Hi Marius,
>>>
>>> ok, Leonardo will hopefully take a look - for you to continue: just
>>> post the partial state values for typical pages right now (you can
>>> also take the pages of the sample as a base if you want).
>>>
>>> best regards,
>>>
>>> Martin
>>>
>>> On Wed, Jul 21, 2010 at 3:23 PM, Marius Petoi <marius.petoi@codebeat.ro>
>>> wrote:
>>> > Hello,
>>> >
>>> > As I see, in JspStateManagerImpl.saveSerializedView (actually in the
>>> > isWritingState() method), there is a check whether the
>>> > JSP_IS_WRITING_STATE_ATTR is set in the FacesContext. But this
>>> attribute is
>>> > set in ViewHandlerImpl.setWritingState() if there is no StateWriter
>>> defined
>>> > (if the current view is a jsp). So, in my opinion, the verification in
>>> the
>>> > JspStateManagerImpl.isWritingState() should also include the
>>> verification of
>>> > the StateWriter. Otherwise, full state saving will work only for JSP-s.
>>> >
>>> > Regards,
>>> > Marius
>>> >
>>> > On Wed, Jul 21, 2010 at 3:49 PM, Martin Marinschek <
>>> mmarinschek@apache.org>
>>> > wrote:
>>> >>
>>> >> Hi Marius
>>> >>
>>> >> > --> Full state saving means setting the context parameter
>>> >> > javax.faces.PARTIAL_STATE_SAVING to false. This is all, right?
I've
>>> >> > noticed
>>> >> > that just by doing this, the xhtml pages don't work anymore...only
>>> the
>>> >> > jsp-s. There is no state saved in xhtml-s. Am I missing something?
>>> >>
>>> >> Oh my. That´s a bug then. Leonardo, can you look into this (not that
I
>>> >> desperately need full state saving, but some users might need it)?
>>> >>
>>> >> best regards,
>>> >>
>>> >> Martin
>>> >>
>>> >> >> On Tue, Jul 20, 2010 at 2:46 PM, Marius Petoi
>>> >> >> <marius.petoi@codebeat.ro>
>>> >> >> wrote:
>>> >> >> > Hi Leonardo,
>>> >> >> >
>>> >> >> > So you are working on UIData at the moment. What about
UIRepeat?
>>> I
>>> >> >> > see
>>> >> >> > that
>>> >> >> > partial state saving is not implemented in UIRepeat components.
>>> We
>>> >> >> > could
>>> >> >> > improve the _childState table (which is included in the
saved
>>> state)
>>> >> >> > to
>>> >> >> > save
>>> >> >> > only the states which are different from an initial state
(like
>>> in
>>> >> >> > UIData
>>> >> >> > components).
>>> >> >> >
>>> >> >> > Regards,
>>> >> >> > Marius
>>> >> >> >
>>> >> >> > On Mon, Jul 19, 2010 at 1:46 PM, Leonardo Uribe <
>>> lu4242@gmail.com>
>>> >> >> > wrote:
>>> >> >> >>
>>> >> >> >> Hi Marius
>>> >> >> >>
>>> >> >> >> Right now I'm working on "MYFACES-2616 Fix UIData
state saving
>>> model
>>> >> >> >> (spec
>>> >> >> >> issue 153)". I hope to attach some new patches, a
example and a
>>> >> >> >> better
>>> >> >> >> documentation in that issue soon, so we can review
it and make
>>> >> >> >> comments.
>>> >> >> >>
>>> >> >> >> regards,
>>> >> >> >>
>>> >> >> >> Leonardo Uribe
>>> >> >> >>
>>> >> >> >> 2010/7/19 Marius Petoi <marius.petoi@codebeat.ro>
>>> >> >> >>>
>>> >> >> >>> Hi Martin,
>>> >> >> >>>
>>> >> >> >>> Regarding state saving in tables, here are my
observations and
>>> >> >> >>> comments:
>>> >> >> >>> - there is no state saved in relation to the UIData
objects.
>>> >> >> >>> - the states saved for the children of the UIData
objects (the
>>> >> >> >>> components
>>> >> >> >>> in the tables) are irrelevant. They are not used
afterwards, as
>>> the
>>> >> >> >>> components are initialized at each request with
default values
>>> and
>>> >> >> >>> the
>>> >> >> >>> state
>>> >> >> >>> saved corresponds to the last modifications of
the component
>>> (to
>>> >> >> >>> the
>>> >> >> >>> row
>>> >> >> >>> which was last set via the setRowIndex() method).
>>> >> >> >>> - every time the setRowIndex() method is invoked
with the -1
>>> >> >> >>> parameter,
>>> >> >> >>> _initialDescendantComponentState is initialized.
This will no
>>> >> >> >>> longer
>>> >> >> >>> be
>>> >> >> >>> necessary, as the initial state will be restored
from the
>>> >> >> >>> previously
>>> >> >> >>> saved
>>> >> >> >>> state.
>>> >> >> >>> - the _rowStates array of states is constructed
using "partial"
>>> >> >> >>> state.
>>> >> >> >>> This means that only states for the rows which
are different
>>> from
>>> >> >> >>> the
>>> >> >> >>> template are saved in this array. In my opinion,
this is what
>>> needs
>>> >> >> >>> to
>>> >> >> >>> be
>>> >> >> >>> saved for the UIData. The children component of
the UIData
>>> should
>>> >> >> >>> have
>>> >> >> >>> no
>>> >> >> >>> state saved (at least not in the first phase -
we could think
>>> that
>>> >> >> >>> if
>>> >> >> >>> something appears in all the rows of _rowStates
for a
>>> componentt,
>>> >> >> >>> then
>>> >> >> >>> we
>>> >> >> >>> could move this down to the component state).
>>> >> >> >>>
>>> >> >> >>> These are just some basic observations about state
saving in
>>> >> >> >>> tables.
>>> >> >> >>> What
>>> >> >> >>> do you think?
>>> >> >> >>>
>>> >> >> >>> Regards,
>>> >> >> >>> Marius
>>> >> >> >>>
>>> >> >> >>> On Wed, Jul 14, 2010 at 4:29 PM, Martin Marinschek
>>> >> >> >>> <mmarinschek@apache.org> wrote:
>>> >> >> >>>>
>>> >> >> >>>> Ok, so you actually checked it - perfect!
>>> >> >> >>>>
>>> >> >> >>>> Next step: is there any component where this
is different?
>>> UIInput
>>> >> >> >>>> is
>>> >> >> >>>> ok - all the other standard components are
ok as well?
>>> >> >> >>>>
>>> >> >> >>>> When we have finished this, take a look at
what Leonardo has
>>> done
>>> >> >> >>>> for
>>> >> >> >>>> partial state saving in data-tables. We will
need to work out
>>> a
>>> >> >> >>>> proposal for an API in JSF 2.1 - and, I guess,
alsongside our
>>> >> >> >>>> implementation, also an implementation for
Mojarra, cause the
>>> RI
>>> >> >> >>>> team
>>> >> >> >>>> will not be able to get this done.
>>> >> >> >>>>
>>> >> >> >>>> best regards,
>>> >> >> >>>>
>>> >> >> >>>> Martin
>>> >> >> >>>>
>>> >> >> >>>> On 7/14/10, Marius Petoi <marius.petoi@codebeat.ro>
wrote:
>>> >> >> >>>> > I placed a breakpoint in
>>> >> >> >>>> > DefaultFaceletsManagementStrategy.saveStateOnMap,
>>> >> >> >>>> > in the point where saveState is called
for each component.
>>> That
>>> >> >> >>>> > is
>>> >> >> >>>> > the
>>> >> >> >>>> > point
>>> >> >> >>>> > where the state to be saved is retrieved.
That is where I
>>> got
>>> >> >> >>>> > the
>>> >> >> >>>> > information on the first place. I looked
at each component
>>> and
>>> >> >> >>>> > at
>>> >> >> >>>> > the
>>> >> >> >>>> > returned value of saveState.
>>> >> >> >>>> >
>>> >> >> >>>> > On Wed, Jul 14, 2010 at 3:41 PM, Martin
Marinschek
>>> >> >> >>>> > <mmarinschek@apache.org>wrote:
>>> >> >> >>>> >
>>> >> >> >>>> >> Hi Marius,
>>> >> >> >>>> >>
>>> >> >> >>>> >> "as I see" means you see it, or you
think it is like this
>>> ;) ?
>>> >> >> >>>> >>
>>> >> >> >>>> >> best regards,
>>> >> >> >>>> >>
>>> >> >> >>>> >> Martin
>>> >> >> >>>> >>
>>> >> >> >>>> >> On 7/14/10, Marius Petoi <marius.petoi@codebeat.ro>
wrote:
>>> >> >> >>>> >> > Hi Martin,
>>> >> >> >>>> >> >
>>> >> >> >>>> >> > I think you mean for the attributes
that I say are added
>>> >> >> >>>> >> > before
>>> >> >> >>>> >> > the
>>> >> >> >>>> >> > call
>>> >> >> >>>> >> to
>>> >> >> >>>> >> > markInitialState(). So, as I
see, the
>>> >> >> >>>> >> > org.apache.myfaces.view.facelets.MARK_ID,
locale,
>>> >> >> >>>> >> > uniqueIdCounter,
>>> >> >> >>>> >> > renderKitId, rendererType are
not present in the partial
>>> >> >> >>>> >> > state
>>> >> >> >>>> >> > at
>>> >> >> >>>> >> > the
>>> >> >> >>>> >> > end
>>> >> >> >>>> >> of
>>> >> >> >>>> >> > the lifecycle, although they
are in the StateHelper. The
>>> >> >> >>>> >> > reason
>>> >> >> >>>> >> > for
>>> >> >> >>>> >> > this
>>> >> >> >>>> >> is
>>> >> >> >>>> >> > that they are added there before
the call to
>>> >> >> >>>> >> > markInitialState().
>>> >> >> >>>> >> > So,
>>> >> >> >>>> >> > they
>>> >> >> >>>> >> > will never be in the partial
state.
>>> >> >> >>>> >> >
>>> >> >> >>>> >> > Regards,
>>> >> >> >>>> >> > Marius
>>> >> >> >>>> >> >
>>> >> >> >>>> >> > On Wed, Jul 14, 2010 at 3:05
PM, Martin Marinschek
>>> >> >> >>>> >> > <mmarinschek@apache.org>wrote:
>>> >> >> >>>> >> >
>>> >> >> >>>> >> >> Hi Marius,
>>> >> >> >>>> >> >>
>>> >> >> >>>> >> >> you are sounding a bit unsure
about this - did you
>>> really
>>> >> >> >>>> >> >> check
>>> >> >> >>>> >> >> what
>>> >> >> >>>> >> >> is in the partial state
at the end of the lifecycle?
>>> >> >> >>>> >> >>
>>> >> >> >>>> >> >> best regards,
>>> >> >> >>>> >> >>
>>> >> >> >>>> >> >> Martin
>>> >> >> >>>> >> >>
>>> >> >> >>>> >> >> On 7/14/10, Marius Petoi
<marius.petoi@codebeat.ro>
>>> wrote:
>>> >> >> >>>> >> >> > Hello,
>>> >> >> >>>> >> >> >
>>> >> >> >>>> >> >> > After the improvements
we discussed in previous
>>> threads,
>>> >> >> >>>> >> >> > here
>>> >> >> >>>> >> >> > is
>>> >> >> >>>> >> >> > what
>>> >> >> >>>> >> >> > the
>>> >> >> >>>> >> >> > state looks like for
some of the components:
>>> >> >> >>>> >> >> >
>>> >> >> >>>> >> >> > - the org.apache.myfaces.view.facelets.MARK_ID
>>> >> >> >>>> >> >> > (ComponentSupport.MARK_CREATED)
attribute is present
>>> in
>>> >> >> >>>> >> >> > almost
>>> >> >> >>>> >> >> > all
>>> >> >> >>>> >> >> > the
>>> >> >> >>>> >> >> > components, but that
is put in the attributes map
>>> before
>>> >> >> >>>> >> >> > the
>>> >> >> >>>> >> >> > initial
>>> >> >> >>>> >> >> state
>>> >> >> >>>> >> >> > is marked, so I think
it does not affect partial state
>>> >> >> >>>> >> >> > saving
>>> >> >> >>>> >> >> >
>>> >> >> >>>> >> >> > - same goes for locale,
uniqueIdCounter, renderKitId,
>>> >> >> >>>> >> >> > rendererType,
>>> >> >> >>>> >> >> > which
>>> >> >> >>>> >> >> > are also attributes
in the StateHelper, but are added
>>> >> >> >>>> >> >> > before
>>> >> >> >>>> >> >> > the
>>> >> >> >>>> >> >> > call
>>> >> >> >>>> >> to
>>> >> >> >>>> >> >> > markInitialState().
So they also shouldn't be included
>>> in
>>> >> >> >>>> >> >> > the
>>> >> >> >>>> >> >> > partial
>>> >> >> >>>> >> >> state.
>>> >> >> >>>> >> >> >
>>> >> >> >>>> >> >> > - for UIInput, the
partial state contains the value,
>>> >> >> >>>> >> >> > localValueSet,
>>> >> >> >>>> >> >> > submittedValue and
valid properties. This is the
>>> partial
>>> >> >> >>>> >> >> > state
>>> >> >> >>>> >> >> > which
>>> >> >> >>>> >> is
>>> >> >> >>>> >> >> > stored after one submit.
>>> >> >> >>>> >> >> >
>>> >> >> >>>> >> >> > Do you have other suggestions
about what else could be
>>> >> >> >>>> >> >> > improved
>>> >> >> >>>> >> >> > in
>>> >> >> >>>> >> >> partial
>>> >> >> >>>> >> >> > state saving?
>>> >> >> >>>> >> >> >
>>> >> >> >>>> >> >> > Regards,
>>> >> >> >>>> >> >> > Marius
>>> >> >> >>>> >> >> >
>>> >> >> >>>> >> >>
>>> >> >> >>>> >> >>
>>> >> >> >>>> >> >> --
>>> >> >> >>>> >> >>
>>> >> >> >>>> >> >> http://www.irian.at
>>> >> >> >>>> >> >>
>>> >> >> >>>> >> >> Your JSF powerhouse -
>>> >> >> >>>> >> >> JSF Consulting, Development
and
>>> >> >> >>>> >> >> Courses in English and German
>>> >> >> >>>> >> >>
>>> >> >> >>>> >> >> Professional Support for
Apache MyFaces
>>> >> >> >>>> >> >>
>>> >> >> >>>> >> >
>>> >> >> >>>> >>
>>> >> >> >>>> >>
>>> >> >> >>>> >> --
>>> >> >> >>>> >>
>>> >> >> >>>> >> http://www.irian.at
>>> >> >> >>>> >>
>>> >> >> >>>> >> Your JSF powerhouse -
>>> >> >> >>>> >> JSF Consulting, Development and
>>> >> >> >>>> >> Courses in English and German
>>> >> >> >>>> >>
>>> >> >> >>>> >> Professional Support for Apache MyFaces
>>> >> >> >>>> >>
>>> >> >> >>>> >
>>> >> >> >>>>
>>> >> >> >>>>
>>> >> >> >>>> --
>>> >> >> >>>>
>>> >> >> >>>> http://www.irian.at
>>> >> >> >>>>
>>> >> >> >>>> Your JSF powerhouse -
>>> >> >> >>>> JSF Consulting, Development and
>>> >> >> >>>> Courses in English and German
>>> >> >> >>>>
>>> >> >> >>>> Professional Support for Apache MyFaces
>>> >> >> >>>
>>> >> >> >>
>>> >> >> >
>>> >> >> >
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> --
>>> >> >>
>>> >> >> http://www.irian.at
>>> >> >>
>>> >> >> Your JSF powerhouse -
>>> >> >> JSF Consulting, Development and
>>> >> >> Courses in English and German
>>> >> >>
>>> >> >> Professional Support for Apache MyFaces
>>> >> >
>>> >> >
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >>
>>> >> http://www.irian.at
>>> >>
>>> >> Your JSF powerhouse -
>>> >> JSF Consulting, Development and
>>> >> Courses in English and German
>>> >>
>>> >> Professional Support for Apache MyFaces
>>> >
>>> >
>>>
>>>
>>>
>>> --
>>>
>>> http://www.irian.at
>>>
>>> Your JSF powerhouse -
>>> JSF Consulting, Development and
>>> Courses in English and German
>>>
>>> Professional Support for Apache MyFaces
>>>
>>
>>
>

Mime
View raw message