-
Notifications
You must be signed in to change notification settings - Fork 27
/
bench.js
30 lines (27 loc) · 959 Bytes
/
bench.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var buffer = require('./');
var Benchmark = require('benchmark');
var fs = require('fs');
var pt = JSON.parse(fs.readFileSync(__dirname+'/test/fixtures/in/Point.geojson'));
var line = JSON.parse(fs.readFileSync(__dirname+'/test/fixtures/in/LineString.geojson'));
var polygon = JSON.parse(fs.readFileSync(__dirname+'/test/fixtures/in/Polygon.geojson'));
var fc = JSON.parse(fs.readFileSync(__dirname+'/test/fixtures/in/FeatureCollection.geojson'));
var suite = new Benchmark.Suite('turf-buffer');
suite
.add('turf-buffer#Point',function () {
buffer(pt, 10, 'miles');
})
.add('turf-buffer#LineString',function () {
buffer(line, 10, 'miles');
})
.add('turf-buffer#Polygon',function () {
buffer(polygon, 10, 'miles');
})
.add('turf-buffer#FeatureCollection',function () {
buffer(fc, 10, 'miles');
})
.on('cycle', function (event) {
console.log(String(event.target));
})
.on('complete', function () {
})
.run();