Highcharts update vs new chart (v15)

Revision 15 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="//code.highcharts.com/highcharts.js"></script>
<script src="//code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="height: 400px"></div>

Setup

var a = [1, 2, 3, 4, 5, 6, 7, 8];
    var b = [8, 7, 6, 5, 4, 3, 2, 1];
    var options = {
      chart: {
        renderTo: 'container',
      },
      series: [{
        name: 'A',
        data: a
      }, {
        name: 'B',
        data: b
      }]
    };
    var chart;

Teardown


    chart.destroy();
  

Test runner

Ready to run.

Testing in
TestOps/sec
new chart
chart = new Highcharts.Chart(options);
chart.destroy();
options.series[0].data = b;
options.series[1].data = a;
chart = new Highcharts.Chart(options);
ready
setData
chart = new Highcharts.Chart(options);
chart.series[0].setData(b, false);
chart.series[1].setData(a, false);
chart.redraw();
ready
update
chart = new Highcharts.Chart(options);
for (var i = 0; i < 2; i++)
{
  for (var j = 0; j < 8; j++)
    chart.series[i].data[j].update([1,1], false);
}
chart.redraw();
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.