This is an automated email from the git hooks/post-receive script. sebastic pushed a commit to branch master in repository node-rbush.
commit bb997ebb433c3553d09382dd0c65ab9f8477d90f Author: Bas Couwenberg <sebas...@xs4all.nl> Date: Sun Dec 24 12:39:18 2017 +0100 New upstream version 2.0.2 --- .npmignore | 4 ---- MIT-LICENSE => LICENSE | 2 ++ README.md | 21 +++++++++++++++++---- index.js | 3 ++- package.json | 28 +++++++++++++++++----------- viz/viz-cluster.html | 5 ++++- viz/viz-uniform.html | 2 +- 7 files changed, 43 insertions(+), 22 deletions(-) diff --git a/.npmignore b/.npmignore deleted file mode 100644 index ecf30e1..0000000 --- a/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -bench -viz -test -.travis.yml diff --git a/MIT-LICENSE b/LICENSE similarity index 98% rename from MIT-LICENSE rename to LICENSE index 94d9eed..f74668a 100644 --- a/MIT-LICENSE +++ b/LICENSE @@ -1,3 +1,5 @@ +MIT License + Copyright (c) 2016 Vladimir Agafonkin Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/README.md b/README.md index aeeeb65..947fe0e 100644 --- a/README.md +++ b/README.md @@ -19,20 +19,30 @@ Open web console to see benchmarks; click on buttons to insert or remove items; click to perform search under the cursor. -* [uniformly distributed random data](http://mourner.github.io/rbush/viz/viz-uniform.html) * [randomly clustered data](http://mourner.github.io/rbush/viz/viz-cluster.html) +* [uniformly distributed random data](http://mourner.github.io/rbush/viz/viz-uniform.html) + +## Install + +Install with NPM (`npm install rbush`), or use CDN links for browsers: +[rbush.js](https://unpkg.com/rbush@2.0.1/rbush.js), +[rbush.min.js](https://unpkg.com/rbush@2.0.1/rbush.min.js) ## Usage ### Creating a Tree ```js -var tree = rbush(9); +var tree = rbush(); ``` An optional argument to `rbush` defines the maximum number of entries in a tree node. -It drastically affects the performance, so you should adjust it -considering the type of data and search queries you perform. +`9` (used by default) is a reasonable choice for most applications. +Higher value means faster insertion and slower search, and vice versa. + +```js +var tree = rbush(16); +``` ### Adding Data @@ -65,6 +75,7 @@ which is useful when you only have a copy of the object you need removed (e.g. l tree.remove(itemCopy, function (a, b) { return a.id === b.id; }); +``` Remove all items: @@ -84,6 +95,8 @@ var tree = rbush(9, ['[0]', '[1]', '[0]', '[1]']); // accept [x, y] points tree.insert([20, 50]); ``` +If you're indexing a static list of points (you don't need to add/remove points after indexing), you should use [kdbush](https://github.com/mourner/kdbush) which performs point indexing 5-8x faster than RBush. + ### Bulk-Inserting Data Bulk-insert the given data into the tree: diff --git a/index.js b/index.js index c96e1af..55d1168 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ 'use strict'; module.exports = rbush; +module.exports.default = rbush; var quickselect = require('quickselect'); @@ -90,7 +91,7 @@ rbush.prototype = { return this; } - // recursively build the tree with the given data from stratch using OMT algorithm + // recursively build the tree with the given data from scratch using OMT algorithm var node = this._build(data.slice(), 0, data.length - 1, 0); if (!this.data.children.length) { diff --git a/package.json b/package.json index ab566f0..f97da03 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rbush", - "version": "2.0.1", + "version": "2.0.2", "description": "High-performance 2D spatial index for rectangles (based on R*-tree with bulk loading and bulk insertion algorithms)", "homepage": "https://github.com/mourner/rbush", "repository": { @@ -18,24 +18,30 @@ "author": "Vladimir Agafonkin", "license": "MIT", "main": "index.js", + "jsdelivr": "rbush.js", + "unpkg": "rbush.js", "devDependencies": { - "benchmark": "^2.1.0", - "browserify": "^13.0.1", - "eslint": "^2.10.2", - "eslint-config-mourner": "^2.0.1", + "benchmark": "^2.1.4", + "browserify": "^14.5.0", + "eslint": "^4.13.1", + "eslint-config-mourner": "^2.0.3", "faucet": "0.0.1", - "istanbul": "~0.4.3", - "tape": "^4.5.1", - "uglify-js": "^2.6.4" + "istanbul": "~0.4.5", + "tape": "^4.8.0", + "uglify-js": "^3.2.2" }, "scripts": { "test": "eslint index.js test/test.js && node test/test.js | faucet", - "perf": "node ./debug/perf.js", + "perf": "node ./bench/perf.js", "cov": "istanbul cover test/test.js -x test/test.js", "build": "browserify index.js -s rbush -o rbush.js", "build-min": "browserify index.js -s rbush | uglifyjs -c warnings=false -m > rbush.min.js", - "prepublish": "npm run build && npm run build-min" + "prepare": "npm run build && npm run build-min" }, + "files": [ + "rbush.js", + "rbush.min.js" + ], "eslintConfig": { "extends": "mourner", "rules": { @@ -44,6 +50,6 @@ } }, "dependencies": { - "quickselect": "^1.0.0" + "quickselect": "^1.0.1" } } diff --git a/viz/viz-cluster.html b/viz/viz-cluster.html index a6298df..73f9ebb 100644 --- a/viz/viz-cluster.html +++ b/viz/viz-cluster.html @@ -21,8 +21,9 @@ function genData(N, M, R) { var data = []; for (var i = 0; i < M; i++) { var cluster = randClusterPoint(R); + var size = Math.min(Math.ceil(N / M), N - data.length); - for (var j = 0; j < N / M; j++) { + for (var j = 0; j < size; j++) { data.push(randClusterBox(cluster, R, 1)); } } @@ -44,6 +45,8 @@ function genInsertOneByOne(K, M) { } console.timeEnd('insert ' + K + ' items'); + data = data.concat(data2); + draw(); }; } diff --git a/viz/viz-uniform.html b/viz/viz-uniform.html index 4a5bb3c..0952284 100644 --- a/viz/viz-uniform.html +++ b/viz/viz-uniform.html @@ -13,7 +13,7 @@ <script src="viz.js"></script> <script> -var N = 50000; +var N = 100000; function genData(N) { var data = []; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/node-rbush.git _______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel