1. #1
    Ext User
    Join Date
    Sep 2007
    Posts
    7
    Vote Rating
    0
    tuler is on a distinguished road

      0  

    Default Grid performance tips

    Grid performance tips


    Hi,

    I need to update the contents of a grid as fast as possible.
    My first try was a tradicional approach, updating the underlying record.

    Code:
    function onMessage(message) {
      var record = ds.getById(message.data.id);
      var copy = record.copy();
      var values = message.data;
      record.set('price', values[0]);
      record.set('open', values[1]);
      record.set('close', values[2]);
      record.set('high', values[3]);
      record.set('low', values[4]);
      record.set('quantity', values[5]);
      record.set('volume', values[6]);
      record.commit();  
    }
    but this is veeery slow...
    I have some profile results if you are interested.
    Basically camelFn and the GridView are killing the performance.

    So I took another approach, just update the grid cell contents, like this:

    Code:
    function onMessage(message) {
      var record = {};
      record['price'] = values[0];
      record['open'] = values[1];
      record['close'] = values[2];
      record['high'] = values[3];
      record['low'] = values[4];
      record['quantity'] = values[5];
      record['volume'] = values[6];
    
      var index = ds.indexOfId(symbol);
      var view = grid.getView();
      var cm = grid.getColumnModel();
      (... loop through columns ... for each column)
      var cell = view.getCell(index, i);
      var el = Ext.get(cell);
      var cellText = el.child('.x-grid-cell-text', true);
      cellText.innerHTML = data;
    }
    This is way faster...
    But... The underlying dataset is not updated.
    So when I do anything with the grid, like moving a column the displayed "data" is lost (actually the underlying data was never updated).

    Any tips to make the appropriate approach faster?
    Thanks,
    Danilo

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,785
    Vote Rating
    597
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Because the data for a record is stored in inside a variable in the record, your code should look something like this:

    Code:
    record.data.price = 1; //record.data.price is equivalent to record.data['price'], but a whole lot quicker.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."