1

im having table with more than 1k rows and more than 7 columns, trying to parse into array object, i tried using jquery

$(tableSearch).each(function () {
    $('tr', $(this)).each(function (key, tr) {
        var self = this;
        var obj = new Object();
        var rowPos = 0;
        $('td', tr).each(function (rowPos) {
            obj[_self.colModel[rowPos].name] = $(this).html();
        });
        obj['Key'] = 'Rec-' + key;
    });
});

in FF it takes 300 milli seconds, but in IE its taking 60 seconds :(

as u can compare its around 200 times slower.

is there any way to get performance in IE. i tried raw javascript methods also still in IE efficiency is not achieved.

help me!!!!!!!.. how can i get similar performance in all browsers.

THANKS in Advance

6
  • There is no way to get around this. You should consider running the code as a background thread if the task can be deferred stackoverflow.com/questions/1160137/… OR show user some kind of progress bar.. Commented Aug 16, 2011 at 12:53
  • A Porsche is faster than a turtle, that's life. As long as a turtle can't run faster you'll need to speed-down the Porsche to get similar speed. Commented Aug 16, 2011 at 13:06
  • Can't you leave the data in the table? $("#tableId tr").eq(1000) Commented Aug 16, 2011 at 13:11
  • 1
    IM TRYING TO GENERATE GRID(I HAVE TO USE JQGRID) FROM A TABLE OF DATA. SO I NEED TO PARSE THAT TABLE TO ARRAY OBJECT. I DONT HAVE ANY OTHER CHOICE. AS I WILL NOT HAVE ANY ACCESS TO THE WAY THIS TABLE IS GENERATING. ITS A HUGE SECURE SYSTEM. WHICH WILL GIVE ONLY TABLE OF DATA. WHERE I NEED TO ADD ALL OPERATION LIKE ADD, DELETE BUTTONS DYNAMICALLY.. Commented Aug 16, 2011 at 13:19
  • 1
    Have you tried to do it without jQuery? Maybe it´s faster when it is a simple for loop. Maybe.. ^^ Commented Aug 16, 2011 at 13:56

1 Answer 1

0

i got the solution IE can be faster if we implemented this way

table = document.getElementById("myGrid");
    for (i = 0; i < table.rows.length; i += 1) {
       var rowData = new Array();
       row = table.rows[i];
       for (j = 0; j < row.cells.length; j += 1) {
           cell = row.cells[j];
           rowData[j] = cell.innerHtml
       }
       obj.push(rowData);
    }

Note: disable debug mode if ur using any debugger.

then IE seems to be reasonable but cant be faster than FF or safari

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.