Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for release 0.0.4 #47

Merged
merged 20 commits into from
Jan 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ build/

# Directory created by dartdoc
doc/api/

coverage/
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.0.4

- Implements the `featureEach` and `propEach` meta function. [#24](https://github.com/dartclub/turf_dart/pull/24)
- PR [#43](https://github.com/dartclub/turf_dart/pull/43):
- Several bugfixes with the deserialization of JSON
- Several new constructors
- Vector arithmetics operations

## 0.0.3

- Null-safety support
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ This includes a fully [RFC 7946](https://tools.ietf.org/html/rfc7946)-compliant

Most of the implementation is a direct translation from [turf.js](https://github.com/Turfjs/turf).

## Tests and Benchmarks
Tests are run with `dart test` and benchmarks can be run with
`dart run benchmark`

Any new benchmarks must be named `*_benchmark.dart` and reside in the
`./benchmark` folder.

## Components

### Measurement
Expand Down
83 changes: 83 additions & 0 deletions benchmark/meta_benchmark.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import 'package:benchmark/benchmark.dart';
import 'package:turf/helpers.dart';
import 'package:turf/meta.dart';

void main() {
Point pt = Point.fromJson({
'coordinates': [0, 0]
});

Feature<Point> featurePt = Feature(geometry: pt.clone());

List<Point> points = [];
List<Feature<Point>> pointFeatures = [];

for (int i = 0; i < 1000; i++) {
points.add(pt.clone());
pointFeatures.add(Feature(geometry: pt.clone()));
}

GeometryCollection geomCollection = GeometryCollection(
geometries: points,
);

FeatureCollection featureCollection = FeatureCollection(
features: pointFeatures,
);

group('geomEach', () {
void geomEachNoopCB(
GeometryObject? currentGeometry,
int? featureIndex,
Map<String, dynamic>? featureProperties,
BBox? featureBBox,
dynamic featureId,
) {}

benchmark('geometry', () {
geomEach(pt, geomEachNoopCB);
});

benchmark('feature', () {
geomEach(featurePt, geomEachNoopCB);
});

benchmark('geometry collection', () {
geomEach(geomCollection, geomEachNoopCB);
});

benchmark('feature collection', () {
geomEach(featureCollection, geomEachNoopCB);
});
});

group('propEach', () {
void propEachNoopCB(
Map<String, dynamic>? currentProperties,
num featureIndex,
) {}

benchmark('feature', () {
propEach(featurePt, propEachNoopCB);
});

benchmark('feature collection', () {
propEach(featureCollection, propEachNoopCB);
});
});

group('featureEach', () {
void featureEachNoopCB(
Feature currentFeature,
num featureIndex,
) {}

benchmark('feature', () {
featureEach(featurePt, featureEachNoopCB);
});

benchmark('feature collection', () {
featureEach(featureCollection, featureEachNoopCB);
});
});
}
Loading