[CLOSED] Discussion: High performance with gridPanel

  1. #1

    [CLOSED] Discussion: High performance with gridPanel

    Hi!!!!

    I wish high performance in loading data in gridPanel...
    The performance in loading data in gridPanel, in this moment, is very satisfatory... But I wish target the top level scale.

    Most part of my code is javascript.
    The data access between gridPanel and database is with Json Webservice.
    The WebService is returning a Extnet.Paging object serialized...
    My database server is SQL Server 2k12.
    I'm access data with sqlCommand and DataTable.
    The data are returning paged... between 20 and 50 records each time.
    I populate Extnet.paging with data returned in DataTable with a loop in datatable records. I think this is a critical step.

    1- What is the best type of access data with high performance?
    2 - There are any type of populate paging with a datareader instead of datatable? Without looping?
    3 - Some article about performance in gridpanel?

    Thanks a lot for any help.
    Last edited by Daniil; Mar 26, 2013 at 4:20 AM. Reason: [CLOSED]
  2. #2
    Hi @supera,

    Quote Originally Posted by supera View Post
    I populate Extnet.paging with data returned in DataTable with a loop in datatable records. I think this is a critical step.
    Maybe. Can you demonstrate the code how you do that?

    Quote Originally Posted by supera View Post
    1- What is the best type of access data with high performance?
    As I know the best thing to retrieve data from a database is to call a stored procedure once.

    A general question, a general answer:)

    Quote Originally Posted by supera View Post
    2 - There are any type of populate paging with a datareader instead of datatable? Without looping?
    The main point is retrieving the data from a database.

    Then it is not a big deal to populate a Paging class any way you wish. I think it is a big deal to make it really slow:)

    Quote Originally Posted by supera View Post
    3 - Some article about performance in gridpanel?
    I know some ones regarding client side performance. But it all is not new for you. Mostly, it is paging and buffering.

    Regarding server <=> database relations I think there is a lot of good articles on the internet. Unfortunately, I can't suggest something concrete.

    =====

    By the way, you always can change something and look at how it goes. You just need good measuring.
  3. #3
    Hi Daniil!

    Thanks for your comments.

    Maybe. Can you demonstrate the code how you do that?
    I have a storedProcedure returning the records paged and totalrecords of sql statement... after datatable is filled, I populate paging with ConvertDataTableToExtNetPaging function. About this function, is there anything I can improve?

    Public Shared Function ConvertDataTableToExtNetPaging(dt As System.Data.DataTable, ByVal totalRecords As Long) As Ext.Net.Paging(Of Dictionary(Of String, Object))
            Dim list As List(Of Dictionary(Of String, Object)) = New List(Of Dictionary(Of String, Object))
            Dim row As System.Data.DataRow
            Dim col As System.Data.DataColumn
            Dim listItem As Dictionary(Of String, Object)
    
            For Each row In dt.Rows
                listItem = New Dictionary(Of String, Object)
                For Each col In row.Table.Columns
    				listItem.Add(col.ColumnName.ToUpper.Trim, row(col))
                Next col
                list.Add(listItem)
            Next row
    
            Return New Ext.Net.Paging(Of Dictionary(Of String, Object))(list.AsEnumerable, totalRecords)
    
        End Function
    As I know the best thing to retrieve data from a database is to call a stored procedure once.

    A general question, a general answer:)
    Sorry about my difficult in make this question: My question refers about the data transfer between serverside and clientside. Paging/Json is the better option?


    I know some ones regarding client side performance. But it all is not new for you. Mostly, it is paging and buffering.
    I will be very grateful if you can indicate anything...


    By the way, you always can change something and look at how it goes. You just need good measuring.
    Yes! I'm using a firebug and tunning my source code...
    Thanks a lot for your comments and tips... Are very important for me.
  4. #4
    Quote Originally Posted by supera View Post
    I have a storedProcedure returning the records paged and totalrecords of sql statement... after datatable is filled, I populate paging with ConvertDataTableToExtNetPaging function. About this function, is there anything I can improve?

    Public Shared Function ConvertDataTableToExtNetPaging(dt As System.Data.DataTable, ByVal totalRecords As Long) As Ext.Net.Paging(Of Dictionary(Of String, Object))
            Dim list As List(Of Dictionary(Of String, Object)) = New List(Of Dictionary(Of String, Object))
            Dim row As System.Data.DataRow
            Dim col As System.Data.DataColumn
            Dim listItem As Dictionary(Of String, Object)
    
            For Each row In dt.Rows
                listItem = New Dictionary(Of String, Object)
                For Each col In row.Table.Columns
                    listItem.Add(col.ColumnName.ToUpper.Trim, row(col))
                Next col
                list.Add(listItem)
            Next row
    
            Return New Ext.Net.Paging(Of Dictionary(Of String, Object))(list.AsEnumerable, totalRecords)
    
        End Function
    I guess the ConvertDataTableToExtNetPaging method takes insignificant time comparing with a stored procedure call. I would measure it.

    But, certainly, you are good trying to optimize it as well. Though, the method looks good. But there is something to improve.

    For example, this
    col.ColumnName.ToUpper.Trim
    is enough to call once for each column.

    In your method it is called for each row. Also there is no need to use the Paging class.

    I would implement it like this.

    Example (C#)
    DataTable dt = ...; // getting data from a database
    foreach (DataColumn dc in dt.Columns)
    {
        dc.ColumnName = dc.ColumnName.ToUpper().Trim();
    }
                
    return new
    {
        data = JSON.Serialize(dt),
        total = totalRecords;
    };

    Quote Originally Posted by supera View Post
    Sorry about my difficult in make this question: My question refers about the data transfer between serverside and clientside. Paging/Json is the better option?
    It is good. A buffered store and infinite scrolling can be also an option. Well, it all depends on requirements. In performance aspect the both are more or less the same.

    Quote Originally Posted by supera View Post
    I will be very grateful if you can indicate anything...
    Sure.
    Grid buffered/infinite scrolling in 4.1
    First Look at Ext JS 4.2 Grid | Blog | Sencha
    Ext JS 4.1 Performance | Blog | Sencha
    http://docs.sencha.com/ext-js/4-2/#!/guide/performance
    http://www.sencha.com/forum/showthread.php?153565


    Quote Originally Posted by supera View Post
    Yes! I'm using a firebug and tunning my source code...
    You are good. Also do not forget to measure yuor server side code.
  5. #5
    Hi Daniil!!!

    Thanks a lot for your comments and tips...

    I will research all links...

    I will test serialize datatable too...
    Thanks a lot, again!

Similar Threads

  1. [CLOSED] GridPanel Performance Issue
    By shaileshsakaria in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 03, 2013, 7:12 AM
  2. [CLOSED] Drag and Drop from GridPanel to GridPanel performance issue
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 14
    Last Post: Nov 09, 2012, 3:26 PM
  3. [CLOSED] High CPU on hundred of users
    By jeybonnet in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 10, 2012, 4:06 PM
  4. Replies: 5
    Last Post: Jan 16, 2012, 8:50 AM
  5. Replies: 9
    Last Post: Feb 24, 2009, 3:17 PM

Posting Permissions