simplify-js
simplify-js copied to clipboard
Ported to ES6
I used rbush and flatbush as an example. I
- adopted eslint with
eslint-config-mourner - added rollup
- swapped in
let,const, andimport - added a
modulefield inpackage.json - added npm/yarn scripts:
perf, pretest, test
Tests pass
eslint index.js test/test.js
tape -r esm test/test.js | faucet
# ✓ simplifies points correctly with the given tolerance
# ✓ just return the points if it has only one point
# ✓ just return the points if it has no points
# # tests 3
# # pass 3
# ✓ ok
# Done in 1.07s.
Performance comparison (no significant difference)
All using node 12.@v1.2.3
Setup script
```sh git checkout v1.2.3 ```node ./bench/bench.js
# Benchmarking simplify on 1118 points...
# simplify (HQ) x 9,448 ops/sec ±1.99% (88 runs sampled)
# simplify x 15,110 ops/sec ±2.73% (88 runs sampled)
teardown script
```sh git checkout - ```Using node + ESM
node -r esm bench/bench.js
# Benchmarking simplify on 1118 points...
# simplify (HQ) x 185 ops/sec ±2.86% (78 runs sampled)
# simplify x 2,144 ops/sec ±3.00% (85 runs sampled)
# Done in 11.14s.
Using current compiled UMD
Setup script
git checkout v1.2.3 -- bench/bench.js
node ./bench/bench.js
# Benchmarking simplify on 1118 points...
# simplify (HQ) x 9,339 ops/sec ±2.03% (90 runs sampled)
# simplify x 14,789 ops/sec ±2.50% (86 runs sampled)