-
19 Aug 2008 9:52 PM #1
Improve performance: filtering some rows in grid from a xml file via xmlreader
Improve performance: filtering some rows in grid from a xml file via xmlreader
I use the above code for filtering some rows of record in grid from a xml file via xmlreaderCode:store.reload({ callback: function() { store.filterBy(function(record, id) { return (record.get('pageno') == 'abc'); }); } });
however, my xml file contains more than 10,000 records, it costs almost 10 seconds or even more than 15 seconds.
What can I do for improving its searching time in xml for some particular fields?
use caching? or special sorting(e.g. quick sort) or ... .?
Pls kindly give me some advise
Thanks in advance
-
19 Aug 2008 9:53 PM #2
Surely it would be faster to filter your XML server side?
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
19 Aug 2008 9:57 PM #3
-
19 Aug 2008 10:01 PM #4
Yes, I was under the assumption that your XML was being generated by something on a web server.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
19 Aug 2008 10:11 PM #5
i see ~
but this xml was not generated by me
i'm not able to use ASP or other server side coding for control its size and number of records
thus,
would it be possible for me to change my Ext JS coding, in order to boost it up by different sorting or caching approaches?
THZ
-
19 Aug 2008 10:14 PM #6
Possibly, it depends how the rest of your code is working.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
19 Aug 2008 10:21 PM #7
in fact, i'm testing the performance of my program like the following:
Code:Ext.onReady(function(){ // create the Data Store var store = new Ext.data.Store({ // load using HTTP url: 'abc.xml', // the return will be XML, so lets set up a reader reader: new Ext.data.XmlReader({ // records will have an "Item" tag record: 'Item', id: 'ASIN', totalRecords: '@total' }, [ // set up the fields mapping into the xml doc // The first needs mapping, the others are very basic {name: 'Author', mapping: 'ItemAttributes > Author'}, 'Title', 'Manufacturer', 'pageno' ]) }); // create the grid var grid = new Ext.grid.GridPanel({ store: store, columns: [ {header: "Author", width: 120, dataIndex: 'Author', sortable: true}, {header: "Title", width: 180, dataIndex: 'Title', sortable: true}, {header: "Manufacturer", width: 115, dataIndex: 'Manufacturer', sortable: true}, {header: "Number of Page", width: 100, dataIndex: 'pageno', sortable: true} ], renderTo:'example-grid', width:540, height:200 }); store.load({ callback: function() { store.filterBy(function(record, id) { return (record.get('pageno') == '17'); }); } }); });
-
19 Aug 2008 10:24 PM #8
Not really.
You might be able to speed up the comparison by making it an integer. Other than that, I don't see how you would make it much faster.
It's the performance hit for having a static file.Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
20 Aug 2008 8:13 PM #9
would it be possible for me to do "indexing" on my static file, in order to boost the filtering time in loading the grid?
and Json file is faster than XML file?
-
20 Aug 2008 8:16 PM #10
1) It's an XML file, not a database, what do you mean by indexing?
2) Yes, fairly significantly because it's native javascript.Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!


Reply With Quote
