-
Notifications
You must be signed in to change notification settings - Fork 1
/
bench.js
36 lines (33 loc) · 921 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
31
32
33
34
35
36
var flip = require('./');
var Benchmark = require('benchmark');
var fs = require('fs');
var point = require('turf-point');
var linestring = require('turf-linestring');
var polygon = require('turf-polygon');
var featurecollection = require('turf-featurecollection');
var pt = point(1,0);
var line = linestring([[1,0], [1,0]]);
var poly = polygon([[[1,0], [1,0], [1,2]], [[.2,.2], [.3,.3],[.1,.2]]]);
var pt1 = point(1,0);
var pt2 = point(1,0);
var fc = featurecollection([pt1, pt2]);
var suite = new Benchmark.Suite('turf-flip');
suite
.add('turf-flip#Point',function () {
flip(pt);
})
.add('turf-flip#LineString',function () {
flip(line);
})
.add('turf-flip#Polygon',function () {
flip(poly);
})
.add('turf-flip#FeatureCollection',function () {
flip(fc);
})
.on('cycle', function (event) {
console.log(String(event.target));
})
.on('complete', function () {
})
.run();