#!/usr/bin/env node

var d3 = require("../../");

var width = 960,
    height = 500;

var points = d3.range(10000).map(function() {
  return [Math.random() * width, Math.random() * height];
});

var voronoi = d3.geom.voronoi()
    .clipExtent([[0, 0], [width, height]]);

var observations = d3.range(20).map(function() {
  process.stdout.write(".");
  var start = process.hrtime();
  voronoi(points);
  var elapsed = process.hrtime(start);
  return elapsed[0] * 1e3 + elapsed[1] / 1e6;
});

console.log("");
console.log(Math.round(d3.mean(observations)) + "ms for 10,000 points.");
