8 Replies Latest reply on Oct 24, 2007 9:05 AM by alexmreis

    [ scrollableDataTable ] Performance issues

    alexmreis

      I'm using scrollableDataTable for an internal use enterprise app that is a translation from an excel sheet into a proper system.

      The table has around 500 rows, and is 60 columns wide.

      ScrollableDataTable is just what I need due to the necessity of the users wanting scrolling, not paging with their data, and also I need fixed headers.

      So far it's working 100% as expected, but it takes a ridiculous amount of CPU power and time to render the whole table.

      Look at the Firebug profiler output when loading the table:
      [img]http://alexeshadow.googlepages.com/profiling[/img]

      It seems I have to somehow disable all those calls to scrollTo somehow.

      Any tips on improving performance in this case?

      Thank you,

      Alex[/img]

        • 1. Re: [ scrollableDataTable ] Performance issues
          alexmreis

          Seems the image didnt work...

          Here's the profiler output
          http://alexeshadow.googlepages.com/profiling

          • 3. Re: [ scrollableDataTable ] Performance issues
            alexmreis

            Oh man... another post with errors... Moderator, pretty please enable post editing lol

            This one's right:
            http://alexeshadow.googlepages.com/profiling.jpg

            • 4. Re: [ scrollableDataTable ] Performance issues
              maksimkaszynski

              what's value of your dataTable's 'rows' attribute

              • 5. Re: [ scrollableDataTable ] Performance issues
                amitev

                Btw what profiling are you using?

                • 6. Re: [ scrollableDataTable ] Performance issues
                  amitev

                  ah firebug profiler sorry

                  • 7. Re: [ scrollableDataTable ] Performance issues
                    alexmreis

                    I have it set to table.setRows(50);

                    Here's my code snippet that builds the table dynamically:

                     public HtmlScrollableDataTable buildConsulta() throws ImportacaoException {
                     HtmlScrollableDataTable table = (HtmlScrollableDataTable) app
                     .createComponent(HtmlScrollableDataTable.COMPONENT_TYPE);
                     table.setVar(TABLE_VAR);
                     table.setId("tabelaConsultar");
                     table.setRendered(true);
                     table.setValueBinding("value", app
                     .createValueBinding("#{consultar.listaPedidos}"));
                     table.setStyleClass("table");
                     table.setHeaderClass("tableHeader");
                     table.setRowClasses("oddRow, evenRow");
                     table.setRows(50);
                     table.setWidth("98%");
                     table.setHeight("500px");
                     addColumnsConsulta(table);
                     return table;
                     }
                    
                     @SuppressWarnings("unchecked")
                     private void addColumnsConsulta(HtmlScrollableDataTable table) throws ImportacaoException {
                     Application app = FacesContext.getCurrentInstance().getApplication();
                     ArrayList<Coluna> colunas = Coluna.getColunas();
                     Collections.sort(colunas);
                     for (Coluna c : colunas) {
                     HtmlColumn column = (HtmlColumn) app
                     .createComponent(HtmlColumn.COMPONENT_TYPE);
                     column.setId(c.getId());
                     column.setWidth((c.getTamanho() * 10) + "px");
                    
                     HtmlOutputText header = (HtmlOutputText) app
                     .createComponent(HtmlOutputText.COMPONENT_TYPE);
                     header.setEscape(false);
                     header.setValue(assembleHeader(c));
                     header.setId("header" + c.getNome() + header.hashCode());
                     column.getFacets().put("header", header);
                    
                    
                     UIInput input = null;
                    
                     input = assembleInputField(c);
                    
                     input.setId("input" + c.getNome() + input.hashCode());
                     column.getChildren().add(input);
                    
                     HtmlMessage msg = (HtmlMessage) app.createComponent(HtmlMessage.COMPONENT_TYPE);
                     msg.setFor(input.getId());
                     msg.setId("message" + c.getNome() + msg.hashCode());
                     msg.setRendered(true);
                     column.getChildren().add(msg);
                     column.setRendered(c.canView());
                     table.getChildren().add(column);
                     }
                     }
                    
                     private HtmlInputText assembleInputField(Coluna c) {
                     HtmlInputText campo = (HtmlInputText) app
                     .createComponent(HtmlInputText.COMPONENT_TYPE);
                     setTipo(campo, c);
                     campo.setDisabled(!c.canEdit());
                     campo.setMaxlength(c.getTamanho());
                     campo.setSize(c.getTamanho());
                     campo.setValueBinding("value", app.createValueBinding("#{" + TABLE_VAR
                     + "." + c.getElExpression() + "}"));
                     return campo;
                     }
                    


                    • 8. Re: [ scrollableDataTable ] Performance issues
                      alexmreis

                      Ok, I set the rows property to the same amount of rows that are visible on-screen (18) and it worked fine, with a minor impact on usability since now any scrolling triggers AJAX updating.

                      I'd suggest the RF team to look into some form of what I would call "Lazy rendering". that is, rendering only what's visible, and on scroll render the next parts, even though the data for it would be (in part) already in the client. I can try to put some work on it and submit a patch if it's ok with the team.

                      Cheers,

                      Alex