:: Forum >>
Suppress repeat data to improve performance
I am finding that when I am displaying above 10,000 records, performance starts to degrade. I am using the javascript array as my datasource and I have implemented functionality to suppress repeating text fields and replace them with '^r^'. This saves a lot on memory in my resultset on the server. When I transfer the data to the javascript array, I fill the data back in.
Several questions:
1. What if I kept the '^r^' and changed the display model to display the correct info? Would this help performance? If yes, what is the best way to do this?
2. Should I consider another methodology instead of the javascript array? From what I got from the forum, the array seems to be the best way to go - but I could easily be wrong on that.
3. Any other suggestions (besides not loading that many rows - it is a requirement from my client that I can not avoid).
Thanks in advance.
Joel
Tuesday, October 10, 2006
BUMP - somewhat urgent for me. Can anyone assist me on this one?
Joel
Tuesday, October 10, 2006
First, check if you have setVirtualMode(false) somewhere in your code and remove that. Switching off virtual mode may work well below 100-1000 rows but for 10'000 rows virtual mode should be set to true (default) otherwise everything will be very slow.
Yes, javascript array is the fastest method and you should avoid doing any manipulations with this amount of data on the client side. So the fastest would be to prepare the data for display on the server (with all necessary formatting) and use setCellText(myDataArray) method.
If you really want to play with text substitution on the client - it may be done with function as a datasource -
var myDataArray = [...];
function myDataFunction(c, r){return myDataArray[r][c].replace(..., ...)};
grid.setCellText(myDataFunction);
Alex (ActiveWidgets)
Tuesday, October 10, 2006
Alex,
Thanks so much for your reply. I am definitely using virtual mode. Great feature! My grid contains a large amount of data. So the data is being stored in the grid html as well as the array. by cutting down the size of the array, shouldn't performance improve?
I'll try the function above. Can I apply it to only specific columns???
Joel
Tuesday, October 10, 2006
I just re-read my question and realize I should be a little more specific.
Is there a way to use this datasource function for only specific columns and the other columns could use the quicker setCellText methodology?
I realize that I could just test the column number in the function you gave me and return the array entry without a replace - but just wondering if I can split the two out...
Joel
Tuesday, October 10, 2006
You can use a combination of the generic function (for all columns) and more specific function for a given column -
function getData(c, r){return myDataArray[r][c]};
function getDataReplace(c, r){return myDataArray[r][c].replace(...)}
grid.setCellText(getData); // all columns
grid.setCellText(getDataReplace, 1); // columns-1 only
Alex (ActiveWidgets)
Tuesday, October 10, 2006
Alex,
Awesome. Exactly what I was looking for!
THANKS
Joel
Tuesday, October 10, 2006
Alex,
One more question regarding this (I promise!!!!).
I'm using setCellFormat() for date fields. Would this work with the setCellText methods above? I'm currently using setCellData().
Thanks again.
Joel
Tuesday, October 10, 2006
No, to activate formatting you should use setCellData() method instead of setCellText().
Alex (ActiveWidgets)
Tuesday, October 10, 2006
FEEDBACK ON THIS - I definitely found a difference in performance.
By storing a repeat indicator in the js array and then using the replace in setCellData, I see very good gains.
For example, to load 14,500 rows of data was taking 50 seconds consistently. Now it is down to 37 seconds.
Joel
Tuesday, October 10, 2006
This topic is archived.
Back to support forum
Forum search