mirror of
https://github.com/penpot/penpot.git
synced 2025-05-23 23:56:11 +02:00
Adapt bench/dev code to use new kdtree api.
This commit is contained in:
parent
447da07789
commit
a01cbfa350
1 changed files with 9 additions and 8 deletions
|
@ -23,14 +23,14 @@
|
||||||
(println "1000x1000,10 -> 10000 points")
|
(println "1000x1000,10 -> 10000 points")
|
||||||
(let [tree (k/create)]
|
(let [tree (k/create)]
|
||||||
(time
|
(time
|
||||||
(k/initialize tree 1000 1000 10 10))))
|
(k/setup tree 1000 1000 10 10))))
|
||||||
|
|
||||||
(defn- bench-init-250000
|
(defn- bench-init-250000
|
||||||
[]
|
[]
|
||||||
(println "5000x5000,10 -> 250000 points")
|
(println "5000x5000,10 -> 250000 points")
|
||||||
(let [tree (k/create)]
|
(let [tree (k/create)]
|
||||||
(time
|
(time
|
||||||
(k/initialize tree 5000 5000 10 10))))
|
(k/setup tree 5000 5000 10 10))))
|
||||||
|
|
||||||
(defn bench-init
|
(defn bench-init
|
||||||
[]
|
[]
|
||||||
|
@ -42,13 +42,13 @@
|
||||||
(defn- bench-knn-160000
|
(defn- bench-knn-160000
|
||||||
[]
|
[]
|
||||||
(let [tree (k/create)]
|
(let [tree (k/create)]
|
||||||
(k/initialize tree 4000 4000 10 10)
|
(k/setup tree 4000 4000 10 10)
|
||||||
(println "KNN Search (160000 points) 1000 times")
|
(println "KNN Search (160000 points) 1000 times")
|
||||||
(time
|
(time
|
||||||
(dotimes [i 1000]
|
(dotimes [i 1000]
|
||||||
(let [pt #js [(rand-int 400)
|
(let [pt #js [(rand-int 400)
|
||||||
(rand-int 400)]]
|
(rand-int 400)]]
|
||||||
(.nearest tree pt 2))))))
|
(k/nearest tree pt 2))))))
|
||||||
|
|
||||||
|
|
||||||
(defn- bench-knn-360000
|
(defn- bench-knn-360000
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
(dotimes [i 1000]
|
(dotimes [i 1000]
|
||||||
(let [pt #js [(rand-int 600)
|
(let [pt #js [(rand-int 600)
|
||||||
(rand-int 600)]]
|
(rand-int 600)]]
|
||||||
(.nearest tree pt 2))))))
|
(k/nearest tree pt 2))))))
|
||||||
|
|
||||||
(defn bench-knn
|
(defn bench-knn
|
||||||
[]
|
[]
|
||||||
|
@ -71,11 +71,12 @@
|
||||||
|
|
||||||
(defn test-accuracity
|
(defn test-accuracity
|
||||||
[]
|
[]
|
||||||
(let [tree (k/create (generate-points 4000 20))]
|
(let [tree (k/create)]
|
||||||
|
(k/setup tree 4000 4000 20 20)
|
||||||
(print "[1742 1419]")
|
(print "[1742 1419]")
|
||||||
(pprint (js->clj (.nearest tree #js [1742 1419] 6)))
|
(pprint (js->clj (k/nearest tree #js [1742 1419] 6)))
|
||||||
(print "[1742 1420]")
|
(print "[1742 1420]")
|
||||||
(pprint (js->clj (.nearest tree #js [1742 1420] 6)))
|
(pprint (js->clj (k/nearest tree #js [1742 1420] 6)))
|
||||||
))
|
))
|
||||||
|
|
||||||
(defn test-interval
|
(defn test-interval
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue