You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by lukuperman <lu...@hotmail.com> on 2012/10/04 22:41:16 UTC

performance on nested dataviews

Hi, in the project I work on there is a matrix that grows in both dimensions.
Currently it is implemented as 2 nested DataViews. I'm seeing the inner-most
dataview's onBeforeRender() takes 2-3 seconds to process 200 checkboxes,
which if I combine it with a 15 outer-most dataview gives me the horrible
number of 30-40 seconds or more. If I have 200 instead of 15, you can
imagine my concern. Should I change to another repeater? Should I use the
DataTable instead of nested dataviews? 
FYI: With the given implementation I tried overriding the Item's
onComponentTagBody() method but the time is spent before reaching that
method, so it doesn't really make a difference to improve that method.

Lucas Kuperman

PS: pagination is not an option and on scroll lazyloading is another topic.
Size of the matrix is not cuestionable unfort



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/performance-on-nested-dataviews-tp4652673.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: performance on nested dataviews

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Lucas,

One option you can explore is streaming your table contents as JSON and do
the rendering at client side. You  can use a default AJAX behavior (as
suggested in another thread) to handle AJAX event on the table. This is not
very "wicket way" but for sure will be more efficient on time and
resources: I have used a similar approach for  application where traffic
has to be as low as possible and responsiveness  has to be high,


On Thu, Oct 4, 2012 at 10:41 PM, lukuperman <lu...@hotmail.com> wrote:

> Hi, in the project I work on there is a matrix that grows in both
> dimensions.
> Currently it is implemented as 2 nested DataViews. I'm seeing the
> inner-most
> dataview's onBeforeRender() takes 2-3 seconds to process 200 checkboxes,
> which if I combine it with a 15 outer-most dataview gives me the horrible
> number of 30-40 seconds or more. If I have 200 instead of 15, you can
> imagine my concern. Should I change to another repeater? Should I use the
> DataTable instead of nested dataviews?
> FYI: With the given implementation I tried overriding the Item's
> onComponentTagBody() method but the time is spent before reaching that
> method, so it doesn't really make a difference to improve that method.
>
> Lucas Kuperman
>
> PS: pagination is not an option and on scroll lazyloading is another topic.
> Size of the matrix is not cuestionable unfort
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/performance-on-nested-dataviews-tp4652673.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com

Re: performance on nested dataviews

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

This wont be very easy :-/

The problem is that you will need to provide MarkupStream which index
is set at the proper position for the markup of the label.
If you make this working then you need to do:

StringResponse tempResponse = new StringResponse();
Response oldResponse = requestCycle.setResponse(tempResponse);
String labelMarkup = "";
try {
   // set markupStream index
   label.render();
} finally {
   requestCycle.setResponse(oldResponse);
   labelMarkup = tempResponse.getContent();
}

and finally use 'labelMarkup' when constructing the body of MyMatrix.

As I said - it wont be easy. But it is not impossible too.

On Thu, Oct 18, 2012 at 10:04 PM, lukuperman <lu...@hotmail.com> wrote:
> Martin,
> the webmarkupcontainer I created looks like this:
>
> public class MyMatrix extends WebMarkupContainer {
>    ...
>    @Override
>    protected void onComponentTagBody(MarkupStream markupStream, ComponentTag
> openTag) {
>       StringBuilder body = new StringBuilder();
>       ...
>       replaceComponentTagBody(markupStream, openTag, body);
>    }
> }
>
> And I would like to reuse a custom label I created and append it to the body
> string. My label looks like:
>
> public class AbbreviatedLabel extends Label
>    ...
>    @Override
>    protected void onComponentTagBody(MarkupStream markupStream, ComponentTag
> openTag) {
>       StringBuffer label = new StringBuffer();
>       <some string manipulation>
>       replaceComponentTagBody(markupStream, openTag, label);
>    }
> }
>
>
> Thanks in advance
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/performance-on-nested-dataviews-tp4652673p4653074.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: performance on nested dataviews

Posted by lukuperman <lu...@hotmail.com>.
Martin,
the webmarkupcontainer I created looks like this:

public class MyMatrix extends WebMarkupContainer {
   ...
   @Override
   protected void onComponentTagBody(MarkupStream markupStream, ComponentTag
openTag) {
      StringBuilder body = new StringBuilder();
      ...
      replaceComponentTagBody(markupStream, openTag, body);
   }
}

And I would like to reuse a custom label I created and append it to the body
string. My label looks like:

public class AbbreviatedLabel extends Label
   ...
   @Override
   protected void onComponentTagBody(MarkupStream markupStream, ComponentTag
openTag) {
      StringBuffer label = new StringBuffer();
      <some string manipulation>
      replaceComponentTagBody(markupStream, openTag, label);
   }
}


Thanks in advance



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/performance-on-nested-dataviews-tp4652673p4653074.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: performance on nested dataviews

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Can you show your code ?

On Mon, Oct 15, 2012 at 1:04 AM, lukuperman <lu...@hotmail.com> wrote:
> Martin, I've implemented my own webmarkupcontainer object and I write the
> html in the onComponentTagBody() method. It works super fast. Now my
> question is, how can I reuse other components I created (labels, etc) from
> within this method? I'm still not familiar with the order of calls, sorry.
> Any help would be appreciated
>
> Lucas Kuperman
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/performance-on-nested-dataviews-tp4652673p4652955.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: performance on nested dataviews

Posted by lukuperman <lu...@hotmail.com>.
Martin, I've implemented my own webmarkupcontainer object and I write the
html in the onComponentTagBody() method. It works super fast. Now my
question is, how can I reuse other components I created (labels, etc) from
within this method? I'm still not familiar with the order of calls, sorry.
Any help would be appreciated

Lucas Kuperman



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/performance-on-nested-dataviews-tp4652673p4652955.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: performance on nested dataviews

Posted by lukuperman <lu...@hotmail.com>.
Martin - thanks! I'll consider custom table seriously. Thanks for the select
example.
Ernesto - behavior was already implemented your way. As far as JSON and
building table on client side, I'll try other approaches first and implement
this as last resource, if all other fails. I'm hoping a custom table will be
enough for my issue, as I don't have transfer restrictions, yet. Thanks for
sharing your thoughts.
Vineet - I implemented lazy loading as you suggested earlier this week. As
far as the use case, imagine a spreadsheet pretty much like google docs,
with the difference that each cell only has a checkbox. This layout allows
populating a many-to-many association behind the scenes. Customer decided
this layout because they used MS Excel before, and are strongly reluctant to
change this.

Thanks 
Lucas Kuperman



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/performance-on-nested-dataviews-tp4652673p4652704.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: performance on nested dataviews

Posted by vineet semwal <vi...@gmail.com>.
i am curious what kind of a user uses 200 columns,what is the use case?
datatable can't give you better performance unless i am missing some
point .i just checked datable's source beriefly.
what you need is a dynamic/partial updating repeater for columns so
say if a row has 50 columns visible at start ,a user can click on link
 in some particular row to see more columns of that row and he can see
next 50 columns.he can click on that link till he wants or till no
more columns for that row are available.
 if you want to do that way you should read Igor Vaynberg's for the
idea http://wicketinaction.com/2008/10/repainting-only-newly-created-repeater-items-via-ajax/


On Fri, Oct 5, 2012 at 2:11 AM, lukuperman <lu...@hotmail.com> wrote:
> Hi, in the project I work on there is a matrix that grows in both dimensions.
> Currently it is implemented as 2 nested DataViews. I'm seeing the inner-most
> dataview's onBeforeRender() takes 2-3 seconds to process 200 checkboxes,
> which if I combine it with a 15 outer-most dataview gives me the horrible
> number of 30-40 seconds or more. If I have 200 instead of 15, you can
> imagine my concern. Should I change to another repeater? Should I use the
> DataTable instead of nested dataviews?
> FYI: With the given implementation I tried overriding the Item's
> onComponentTagBody() method but the time is spent before reaching that
> method, so it doesn't really make a difference to improve that method.
>
> Lucas Kuperman
>
> PS: pagination is not an option and on scroll lazyloading is another topic.
> Size of the matrix is not cuestionable unfort
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/performance-on-nested-dataviews-tp4652673.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
regards,

Vineet Semwal

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: performance on nested dataviews

Posted by Martin Grigorov <mg...@apache.org>.
If you expect to have very big tables then the best approach
performance wise is to create your own Table component that creates
its markup by concatenating the markup of its children components.
For example see the difference between DropDownChoice and Select
components in Wicket. Both components provide the same functionality
but Select uses a sub component SelectOption for all its options and
this makes it more heavy. While DDC just concatenates "<option
...>...</option>"s.

On Fri, Oct 5, 2012 at 6:18 AM, lukuperman <lu...@hotmail.com> wrote:
> Hi Martin, yes I did some profiling focusing on my classes. I'll post the
> results shortly. In the meantime, is there any preference between 2 nested
> dataviews vs datatable when table has dynamic number of columns, considering
> performance as driver?
>
> Lucas Kuperman
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/performance-on-nested-dataviews-tp4652673p4652677.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: performance on nested dataviews

Posted by lukuperman <lu...@hotmail.com>.
Hi Martin, yes I did some profiling focusing on my classes. I'll post the
results shortly. In the meantime, is there any preference between 2 nested
dataviews vs datatable when table has dynamic number of columns, considering
performance as driver?

Lucas Kuperman



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/performance-on-nested-dataviews-tp4652673p4652677.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: performance on nested dataviews

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

How did you measure this ?
Use YourKit/JProfiler/VisualVM to check what is slow exactly.

On Thu, Oct 4, 2012 at 11:41 PM, lukuperman <lu...@hotmail.com> wrote:
> Hi, in the project I work on there is a matrix that grows in both dimensions.
> Currently it is implemented as 2 nested DataViews. I'm seeing the inner-most
> dataview's onBeforeRender() takes 2-3 seconds to process 200 checkboxes,
> which if I combine it with a 15 outer-most dataview gives me the horrible
> number of 30-40 seconds or more. If I have 200 instead of 15, you can
> imagine my concern. Should I change to another repeater? Should I use the
> DataTable instead of nested dataviews?
> FYI: With the given implementation I tried overriding the Item's
> onComponentTagBody() method but the time is spent before reaching that
> method, so it doesn't really make a difference to improve that method.
>
> Lucas Kuperman
>
> PS: pagination is not an option and on scroll lazyloading is another topic.
> Size of the matrix is not cuestionable unfort
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/performance-on-nested-dataviews-tp4652673.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org