highcarts - standard vs custom callback per point on load

Benchmark created on


Preparation HTML

<script src="https://code.highcharts.com/highcharts.js"></script>

<div id="container"></div>

Test runner

Ready to run.

Testing in
TestOps/sec
standard
Highcharts.chart('container', {
  chart: {
    events: {
      load() {
        const chart = this;
        const points = chart.series[0].points;
      }
    }
  },
  plotOptions: {
    series: {
      marker: {
        enabled: false
      }
    }
  },
  series: [{
    data: [{
      x: 0,
      y: 1
    }, {
      x: 1,
      y: 2
    }, {
      x: 2,
      y: null
    }, 
    {
    	x: 3,
      y: 1
    },
    {x: 3.5,
    y: null},
    {
      x: 4,
      y: 5
    }, {
      x: 5,
      y: 6
    }]
  }]

});
ready
Custom callback per point
Highcharts.chart('container', {
  chart: {
    events: {
      load() {
        const chart = this;
        const points = chart.series[0].points;
        points.forEach((point, index) => {
          if (index > 0 && points[index - 1].y === null) {
            point.update({
              marker: {
                enabled: true
              }
            })
          }
        })
      }
    }
  },
  plotOptions: {
    series: {
      marker: {
        enabled: false
      }
    }
  },
  series: [{
    data: [{
      x: 0,
      y: 1
    }, {
      x: 1,
      y: 2
    }, {
      x: 2,
      y: null
    }, 
    {
    	x: 3,
      y: 1
    },
    {x: 3.5,
    y: null},
    {
      x: 4,
      y: 5
    }, {
      x: 5,
      y: 6
    }]
  }]

});
ready

Revisions

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