Help on performance issue

Help on performance issue

dadodado Posts: 17Questions: 0Answers: 0
edited March 2010 in General
Hi Allen,

first, thanks for this great peace of software!
After updateing jquery and Datatables to the latest version, i have a question about the performance of dataTables

When i insert rows via fnReloadAjax i'm not sure if the responsetimes are normal or if i have to search deeper in my code ;-)

Get about 1000 lines from server and hide all via a non matching filter. Now i can instandly filter and see them via a dropdownfield
A line looks like this:
["969_092","Zwickau","10.00","I","Ib","Sachsen","7","21","13","23284","6143"]
Problem is, that i have wait for 7 seconds the get rid of the processing message. After that it works like a charm. I tried to profiled all my code, but i see nothing unuasal. My code needs round about 500ms, getting Data from Server needs a second.
Where can i start the search for the lost time?

And another small issue:
I tried to reset all matching filters at once with
ergebnisTab.fnFilter('');
but this do nothing. I have to loop through all cols an set them to nothing via
ergebnisTab.fnFilter('', sel);
This works

Any hints?

Regards
Daniel

Replies

  • allanallan Posts: 63,204Questions: 1Answers: 10,415 Site admin
    Hi Daniel,

    7 seconds seems like quite a long time to me - but I wonder if that is the browser creating the TR / TD elements needed for the display of your new data. Have you using the 'profile' in Firebug (or Webkit's Inspector)? That might well yield some interesting information bout where the time is being taken up.

    Allan
  • dadodado Posts: 17Questions: 0Answers: 0
    edited March 2010
    Hi Allan,

    thanks for the hint. I didn't know that. Now i see following
    JQ 1.3.2/dT 1.6.2 -> 1.3 seconds (mostly _fnAddData with 0.4s)
    JQ 1.3.2/ dT 1.5.2 -> 1.3 seconds (mostly _fnAddData with 0.4s)
    JQ 1.4.2/ dT 1.5.2 -> 5.8 seconds (mostly has() in JQ with 4.8s, then _fnAddData with 0.4s)
    JQ 1.4.2/ dT 1.6.2 -> 5.8 seconds (mostly has() in JQ with 4.8s, then _fnAddData with 0.4s)

    So the performance updates in JQ doesn't work for me :-(
    So i'll see if there is a way to reduce / eleminate calling 39 times the has()

    Daniel
  • dadodado Posts: 17Questions: 0Answers: 0
    edited March 2010
    Ok,
    searching a little bit a found this:
    I use the fnReloadAjax plugin and found, that i can delete
    that.fnDraw( that );
    without problems. But the performance increases! With the newest versions to 0.8s
    And another question. What does the slice in
    oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
    It simply copies all the stuff?

    And do you have an idea because of the small issue a asked for in my first post?

    Thanks
    Daniel
  • allanallan Posts: 63,204Questions: 1Answers: 10,415 Site admin
    Hi Daniel,

    Wow - I knew that jQuery 1.4.x had a performance impact on DataTables, but I didn't expect it to be _anything_ like that! There was a little impact (about 5-10 seconds in the suite of 1300 odd unit tests), but hopefully the performance improvements in DataTables 1.6.1 would offset anything...

    I wonder how it can work without "that.fnDraw( that );" - unless you are doing a draw somewhere else? It would have thought that would be needed.

    > oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();

    Yes - this makes an independent copy of the array. aiDisplayMaster is the data indexes after being ordered, and aiDisplay is the display indexes after being sorted and filtered. aiDisplay is the one that is really of interest, but the master is needed, for when you need to restore (i.e. remove filtering).

    Regarding your other question about resetting the filtering - I've got a function called "fnSortingReset" which would do what you want on my to-do list - but not quite got around to it yet... So what you are doing at the moment is correct. You can tell fnFilter not to redraw the table when it is called - and then draw it for the last one.

    Regards,
    Allan
This discussion has been closed.