Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: localStorage in ST 2.2.0 very slow and unusable

  1. #1
    Sencha Premium Member
    Join Date
    Feb 2011
    Posts
    75
    Answers
    2

    Default Answered: localStorage in ST 2.2.0 very slow and unusable

    I just update my project from ST 2.1.1 to 2.2.0 and now I am having all types of problems with LocalStoreage. I have the exact load function that loads around 500 records into my localStorage in under 2 seconds, but now the exact process doesn't complete when in ST 2.2.0. If I lower the count to around 100 inserts, it works, but takes 5-10 seconds. If I filter, and then select
    the store.clearFilter() method, it takes up to 2 seconds, which used to be immediate.

    Here is the load function:
    Code:
    //Load each store record to the map
            for (i = 0; i < json.length; i++) {
                   lps.add({locId: '123', 
                    cID: json[i].ID,
                    lat: json[i].Lat,             
                    lng: json[i].Lng,
                    address: json[i].Address,
                    notes: json[i].Notes,
                    nID: json[i].nID,
                    uID: json[i].userID,
                    attempts: json[i].Attempts,
                    status: json[i].Status,
                    icon: mIconPart,
                date: json[i].Date}
                );    
            }
    
    
        //Save all new features to Local storage store
        lps.sync();
    
    
    
    The models look identical. 
    
    Ext.define('D2Map.model.Prospects', {
        extend: 'Ext.data.Model',
    
    
        config: {
            identifier: 'uuid',
            fields: [
                {
                    name: 'id',
                    type: 'auto'
                },
                {
                    name: 'locId',
                    type: 'string'
                },
                {
                    name: 'mId',
                    type: 'int'
                },
                {
                    name: 'cID',
                    type: 'int'
                },
                {
                    name: 'uID',
                    type: 'int'
                },
                {
                    name: 'lat'
                },
                {
                    name: 'lng'
                },
                {
                    name: 'address',
                    type: 'string'
                },
                {
                    name: 'notes',
                    type: 'string'
                },
                {
                    name: 'status',
                    type: 'int'
                },
                {
                    name: 'icon'
                },
                {
                    name: 'nID'
                },
                {
                    dateFormat: 'Y-m-d\\TH:i:s',
                    name: 'date'
                },
                {
                    name: 'attempts',
                    type: 'int'
                },
                {
                    name: 'hasChanged',
                    type: 'boolean'
                }
            ],
            proxy: {
                type: 'localstorage',
                id: 'localProspects'
            }
        }
    });
    
    
    
    Ext.define('D2Map.store.localProspectsStore', {
        extend: 'Ext.data.Store',
    
    
        requires: [
            'D2Map.model.Prospects'
        ],
    
    
        config: {
            autoLoad: true,
            model: 'D2Map.model.Prospects',
            storeId: 'localProspectsStore'
        }
    });
    Please help?
    Last edited by dawesi; 27 May 2013 at 11:30 PM. Reason: put code in code block

  2. Are you guys sure this isn't just because the infinite config was default to true in 2.1.1? Try default: true on the list in 2.2. Maybe that helps. Otherwise it will take a while to create a DOM element for every single store record. Whereas infinite will only create enough items to fill the screen.

  3. #2
    Sencha Premium Member
    Join Date
    Feb 2011
    Posts
    75
    Answers
    2

    Default

    Upon further investigation, it seems to only slow when a list is displayed, once that happens it goes down to a crawl, then any interaction with a list that is tied to the store is very very slow.

    Any help would be greatly appreciated.

  4. #3
    Sencha User
    Join Date
    Apr 2013
    Posts
    27
    Answers
    1

    Default

    I seem to have the same issue, but I am loading data from xml. I think the problem is really the list.

  5. #4
    Sencha Premium Member
    Join Date
    Feb 2011
    Posts
    75
    Answers
    2

    Default

    Yes, I verified the same thing, I create a simple example where I could switch between the ST 2.1.0 and 2.2.0 and the difference is very noticeable, if not unusable on the 2.2.0 side.

  6. #5
    Sencha User
    Join Date
    Aug 2012
    Posts
    10

    Default

    2.2.0 is really terrible for using a store on a list. How come it's so slow. 2.1.x was really fast on this matter.

  7. #6

    Default

    I've too struggled with slow and unusable filtering problem for like 4-5 days. And finally I've decided to go back to 2.1.

  8. #7
    Sencha User
    Join Date
    May 2013
    Posts
    13
    Answers
    1

    Default

    same Problem here. List and localstorage nearly unusable. i've tried to hide the list while syncing the storage. but no success.

  9. #8
    Sencha User
    Join Date
    Aug 2012
    Posts
    10

    Default

    I really hope this will get fixed. Im too far in production to go back to 2.1.
    But I do love the improved sql proxy in ST 2.2.0.

  10. #9
    Sencha User
    Join Date
    Aug 2012
    Posts
    10

    Default slow filling list local storage

    You can speed up the whole process of you wait by adding the store untill the sync process is completed.
    So when sync is completed. Start filling the list with your store.

    In my example below I first get the data from a remote server. Then save it local. Then fill the list.

    (Further problems: second time I sync, it's way slower. Viewing big lists are still slow. Maybe this can be resolved bij creating your own list with custom html in a container. But I hope sencha will just fix this...)

    Code:
    var me = this;
    var store= Ext.data.StoreManager.lookup('xxxx');
    var url = "xxxxx";
    
    // first set proxy to jsonp for connection with remote server 
    store.setProxy({type:'jsonp'});
    store.getProxy().setUrl(url); 
    
    // fill the store with the json
    store.load(function(records, operation, success) {
    
        if (success) {      
            // store is filled, now change to sql proxy for localstorage and sync it.        
            store.setProxy({type:'sql'});
            store.getProxy().setDatabase("localDatabaseName");
    
            // drop table in case of existing table
            store.getProxy().dropTable();
    
            // put store in local websql db
            store.sync();
    
            store.on({
                write: function() { // when ready, 
                       this.getList().setStore(store);
                    }             
                }
            });
    
            store.getProxy().on({
                exception: function() { // this in order to catch exceptions when sync
                    console.log("Transaction exception .... handle the exception here");
                }
            });         
        }
        else {
           console.log("Failed");
            return;
        } 
    }, me);

  11. #10
    Sencha User
    Join Date
    May 2013
    Posts
    13
    Answers
    1

    Default

    thanks vino, i'll give it a try.

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •