Completed
Last Updated: 27 May 2020 11:01 by ADMIN
Bo Yuan
Created on: 19 May 2020 06:27
Category: Spreadsheet
Type: Bug Report
0
Decreased performance in the insertRow method

Bug report

Calling insertRow multiple times over many sheet data causes a slower performance since 2020.1.219.

Reproduction of the problem

http://dojo.telerik.com/EBEtaFOj (2020.1.114)

  1. Click the Add Rows button and wait for the alert.

Current behavior

http://dojo.telerik.com/UJAGUgAl

1 comment
ADMIN
Veselin Tsvetanov
Posted on: 27 May 2020 11:01

Hello Bo Yuan,

The decreased performance is caused by a fix for the following bug:

https://github.com/telerik/kendo-ui-core/issues/4845

The performance hit is caused by the more complicated call to the Math.max() method (after the change it is called with three parameters instead of two). As there is no way to improve the performance of that native JS method, the performance hit could not be avoided.

As per the scenario in question, when a Sheet is DataSource bound, inserting new empty items (lines) is always better done on the DataSource itself instead of the Sheet. The following change will increase considerably the performance of the scenario in question:

$("#btn").on("click", function() {
  var newData = [];
  var date = new Date();

  var data = [];

  for (var i = 0; i < 50; i++) {
    var item = {};
    for (var c = 0; c < 100; c++) {
      item["col" + c] = null;
    }
    data.push(item);
  }

  sheet.dataSource.data(data.concat(dataSource.data().toJSON()));

  alert((new Date() - date)/1000 + " seconds");
});
Here is a Dojo implementing the above scenario:

https://dojo.telerik.com/EFANEbId

Regards,
Veselin Tsvetanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.