DataTable().rows.add(rowArr) creates performance issue.

DataTable().rows.add(rowArr) creates performance issue.

BharathidhasanNBharathidhasanN Posts: 4Questions: 1Answers: 0

If I insert an array of size more than 30, it gets inserted in 4 sec. Time gets increased based on the size of the array.

When I insert an array of size 70 I have got the insertion within 15 Sec, this is too slow and it affects my application performance. I get long running script error and application is not responding the user action.

      console.log(new Date() +' start row insert');
        $('#SomeGrid').DataTable().rows.add(rowArr);
        console.log(new Date() +' end row insert');

This grid is having 10 columns.

Kindly request your help in fixing this performance issue,.

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi BharathidhasanN ,

    I'm not seeing the issue on this example here. I appreciate there are less columns, but it is adding 112 rows instantaneously.

    Are you doing anything on the cells that could slow it down as they get added, such as complex rendering or triggering other events?

    Cheers,

    Colin

  • BharathidhasanNBharathidhasanN Posts: 4Questions: 1Answers: 0
    edited March 2018

    Hi Colin,

    Yes the grid contains 22 columns and all of them has either HTML input controls/3rd party Datepicker/ fontawesome Icons with click event for it.

    Based on the input from the service we actually check the check boxes, fill the input control/ hide/show/disable them. Either one of the operation will be there for each and every cell in during rendering (by using "render" function). We also have fnInitComplete, createdRow, fnDrawCallback events with "Export" to excel button for all the rows.
    This grid also has fixed header and footer functionality.

    I hope these events/functions will be triggered when you use the method (.draw()). Will not have any performance impact when you add an array to a table.

    Regards,
    Bharathi

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi Bharathi,

    Yeah, it does sound like a lot is going on, but it does seem excessively slow nonetheless. It might be worth diagnosing where the performance hit lies by individually disabling the various actions (such as the checkbox check, the filling of the input control, etc) just to get an idea of whether it's a single action that's causing the hit.

    Hope that helps,

    Cheers,

    Colin

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Beyond that, we would need a link to a page showing the issue so we can help to profile the issue.

    Allan

  • BharathidhasanNBharathidhasanN Posts: 4Questions: 1Answers: 0

    @Colin: Let me check by commenting one at a time and will share the result.

This discussion has been closed.