vasturiano / treemap-chart

A treemap interactive chart web component for visualizing hierarchical data
https://vasturiano.github.io/treemap-chart/example/flare/
MIT License
65 stars 15 forks source link

Measuring execution time #6

Open kathsav opened 3 years ago

kathsav commented 3 years ago

Hi,

I am testing the time needed to visualize large sets of data using this code. Is it correct measuring it as:

var t1 = performance.now();
    Treemap()
      .data(genNode())
      .color(d => color(d.name))
      .showLabels(false)
      .minBlockArea(8) 
      .excludeRoot(true)
      .tooltipContent((d, node) => `Size: <i>${node.value}</i>`)
      (document.getElementById('chart'));

 var t2 = performance.now();
 console.log(t2 - t1);

Does anything run asynchronously in this case, since I am not sure I receive rational times?

Thank you in advance.

vasturiano commented 3 years ago

@kathsav yes, the rendering is done asynchronously, so you won't be able to get accurate numbers in this manner. I would suggest to use the performance tab in your browser to perform this type of profiling.