-
Notifications
You must be signed in to change notification settings - Fork 4
/
bench.js
27 lines (24 loc) · 939 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
var bboxClip = require('./');
var Benchmark = require('benchmark');
var fs = require('fs');
var linestring = JSON.parse(fs.readFileSync(__dirname + '/test/fixtures/in/linestring.geojson'));
var polygon = JSON.parse(fs.readFileSync(__dirname + '/test/fixtures/in/polygon.geojson'));
var multilinestring = JSON.parse(fs.readFileSync(__dirname + '/test/fixtures/in/multilinestring.geojson'));
var bbox = [-79.0631103515625, 38.74123075381231, -77.2503662109375, 39.69450749856091];
var suite = new Benchmark.Suite('turf-point-on-line');
suite
.add('turf-bbox-clip#linestring',function () {
bboxClip(linestring, bbox);
})
.add('turf-bbox-clip#polygon',function () {
bboxClip(polygon, bbox);
})
.add('turf-bbox-clip#mulilinestring-simple',function () {
bboxClip(multilinestring, bbox);
})
.on('cycle', function (event) {
console.log(String(event.target));
})
.on('complete', function () {
})
.run();