Comments (2)
From the readme of this site "The code isn't overly-optimized but is written to be correct and readable."
In other words, I know. The code is meant to be more readable than performant.
from java-algorithms-implementation.
@hoerup I did a quick test and I am seeing similar performance between the two implementations with my implementation quite a bit quicker than Geocode at nearest neighbor search. Can you show me what you did to test the performance?
Data Structure (25600 items) | Add time | NNS time |
---|---|---|
My KdTree | 39.58 ms | 70.43 ms |
GeoCode KdTree | 35.69 ms | 243.15 ms |
Testing code below...
my kd tree construction time.
long beforeAddTime = System.nanoTime();
KdTree<KdTree.XYZPoint> tree = new KdTree<KdTree.XYZPoint>(points, 2); // 2 since we only care about two dimensions (x,y)
long afterAddTime = System.nanoTime();
Geocode construction time
long beforeAddTime = System.nanoTime();
KDTree<XYZPoint> tree = new KDTree<XYZPoint>(points);
long afterAddTime = System.nanoTime();
My NNS time:
long beforeContainsTime = System.nanoTime();
for (KdTree.XYZPoint p : points) {
//boolean r = tree.contains(p);
Collection<KdTree.XYZPoint> r = tree.nearestNeighbourSearch(1, p);
assertTrue("Point not found.", p, tree, (r.size()==1 && r.iterator().next().equals(p)));
}
long afterContainsTime = System.nanoTime();
GeoCode NNS time:
long beforeContainsTime = System.nanoTime();
for (XYZPoint p : points) {
XYZPoint r = tree.findNearest(p);
assertTrue("Point not found.", p, tree, r.equals(p));
}
long afterContainsTime = System.nanoTime();
All times measured via ((after-before)/points)
from java-algorithms-implementation.
Related Issues (20)
- Bug in Queue
- BinaryHeapArray::clear function is broken HOT 3
- There is a 404.
- The Google Group is Invisible
- tip about method BinarySearchTree.replaceNodeWithNode()
- Dsa HOT 1
- Broken KdNode equals and compareTo causes the KdTree not to return all valid results
- Interval Tree: Does it support zero length intervals, and does it support querying all overlapping intervals?
- Bug: MultiplyUsingLoopWithStringInput cant handle zero input
- Refactor: centralize type handling for simple operations such as add and subtract, and add branch coverage for this HOT 1
- The functions Matrix.add and Matrix.subtract have unneeded for loops HOT 1
- [Accidental duplicate issue, please delete me]
- Logical error with American flag sorting
- Report on possible code improvements applying design patterns
- Java data structures
- Possible bug in Prim's algorithm HOT 4
- Bug in finding the "Longest Increasing Subsequence" HOT 2
- Possible bug in ArryaQueue HOT 1
- Possible bug in Graph definition HOT 1
- Radial search for KdTree HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from java-algorithms-implementation.