[Patch] improve UnconnectedWays test
In org.openstreetmap.josm.data.validation.tests.UnconnectedWays the method
MyWaySegment.getBounds(double fudge)
is called with the parameter dist which gives the distance in m, but the method uses the value
as latlon degrees. As a result, the calculated bbox is far too large and the search in the
QuadBuckets structure returns more or less all data instead of a few nodes which are then searched sequentially.
I've attached a patch that converts the value. I assume that this also means that the code
regarding nearbyNodeCache is obsolete.
Change History (6)
Resolution: |
→ fixed
|
Status: |
new →
closed
|
I did a few more tests. Without the patch the cache structure was very helpfull:
in a test file with ~6200 highway ways I see
DEBUG: Running test Unconnected highways
DEBUG: cache hit/miss 27893 / 27893
DEBUG: Test 'Unconnected highways' completed in 2.9 s
When I change the code to ignore the cache:
DEBUG: Running test Unconnected highways
DEBUG: cache hit/miss 0 / 55786
DEBUG: Test 'Unconnected highways' completed in 5.5 s
With the patch the times are 169 ms against 186 ms, so the cache still
gives a small benefit, but not much compared to the code complexity.
When you set validator.UnconnectedWays.way_way_distance to e.g. 0.5 in preferences
the cache is used two times more often and the timings are 182 ms against 245 ms
and also the complex code for the cache is used.
So, after all, I'd say we can keep the cache, it doesn't require much memory and can save
a few CPU cycles.