0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-05 13:58:58 -05:00

📎 Minor changes on dev tools.

This commit is contained in:
Andrey Antukh 2021-12-27 09:30:58 +01:00
parent 5c6d72b353
commit 4bc2d7444d
5 changed files with 16 additions and 124 deletions

View file

@ -11,16 +11,15 @@
[cuerdas.core :as str]
#?(:clj [io.aviso.exception :as ie])
#?(:cljs [goog.log :as glog]))
#?(:cljs (:require-macros [app.common.logging]))
#?(:clj
(:import
org.apache.logging.log4j.Level
org.apache.logging.log4j.LogManager
org.apache.logging.log4j.Logger
org.apache.logging.log4j.ThreadContext
org.apache.logging.log4j.CloseableThreadContext
org.apache.logging.log4j.message.MapMessage
org.apache.logging.log4j.spi.LoggerContext)))
#?(:cljs (:require-macros [app.common.logging])
:clj (:import
org.apache.logging.log4j.Level
org.apache.logging.log4j.LogManager
org.apache.logging.log4j.Logger
org.apache.logging.log4j.ThreadContext
org.apache.logging.log4j.CloseableThreadContext
org.apache.logging.log4j.message.MapMessage
org.apache.logging.log4j.spi.LoggerContext)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; CLJ Specific

View file

@ -22,7 +22,8 @@
:main-opts ["-m" "antq.core"]}
:dev
{:extra-deps
{:extra-paths ["dev"]
:extra-deps
{thheller/shadow-cljs {:mvn/version "2.15.12"}
cider/cider-nrepl {:mvn/version "0.26.0"}}}

View file

@ -1,112 +0,0 @@
(ns bench.core
(:require [kdtree.core :as k]
[intervaltree.core :as it]
[cljs.pprint :refer (pprint)]
[cljs.nodejs :as node]))
(enable-console-print!)
;; --- Index Initialization Bechmark
(defn- bench-init-10000
[]
(println "1000x1000,10 -> 10000 points")
(time
(k/generate 1000 1000 10 10)))
(defn- bench-init-250000
[]
(time
(k/generate 5000 5000 10 10)))
(defn bench-init
[]
(bench-init-10000)
(bench-init-10000)
(bench-init-250000)
(bench-init-250000)
(bench-init-10000)
(bench-init-10000)
(bench-init-250000)
(bench-init-250000))
;; --- Nearest Search Benchmark
(defn- bench-knn-160000
[]
(let [tree (k/create)]
(k/setup tree 4000 4000 10 10)
(println "KNN Search (160000 points) 1000 times")
(time
(dotimes [i 1000]
(let [pt #js [(rand-int 400)
(rand-int 400)]]
(k/nearest tree pt 2))))))
(defn- bench-knn-360000
[]
(let [tree (k/create)]
(k/initialize tree 6000 6000 10 10)
(println "KNN Search (360000 points) 1000 times")
(time
(dotimes [i 1000]
(let [pt #js [(rand-int 600)
(rand-int 600)]]
(k/nearest tree pt 2))))))
(defn bench-knn
[]
(bench-knn-160000)
(bench-knn-360000))
;; --- Accuracity tests
(defn test-accuracity
[]
(let [tree (k/create)]
(k/setup tree 4000 4000 20 20)
(print "[1742 1419]")
(pprint (js->clj (k/nearest tree #js [1742 1419] 6)))
(print "[1742 1420]")
(pprint (js->clj (k/nearest tree #js [1742 1420] 6)))
))
(defn test-interval
[]
(let [tree (it/create)]
(it/add tree #js [1 5])
(it/add tree #js [5 7])
(it/add tree #js [-4 -1])
(it/add tree #js [-10 -3])
(it/add tree #js [-20 -10])
(it/add tree #js [20 30])
(it/add tree #js [3 9])
(it/add tree #js [100 200])
(it/add tree #js [1000 2000])
(it/add tree #js [6 9])
(js/console.dir tree #js {"depth" nil})
(js/console.log "contains", 4, (it/contains tree 4))
(js/console.log "contains", 0, (it/contains tree 0))
))
(defn main
[& [type]]
(cond
(= type "kd-init")
(bench-init)
(= type "kd-search")
(bench-knn)
(= type "kd-test")
(test-accuracity)
(= type "interval")
(test-interval)
:else
(println "not implemented")))
(set! *main-cli-fn* main)

View file

@ -0,0 +1,5 @@
(ns cljs.user)
(defn hello
[]
(js/console.log "hello"))

View file

@ -4,7 +4,6 @@
:jvm-opts ["-Xmx700m" "-Xms100m" "-XX:+UseSerialGC" "-XX:-OmitStackTraceInFastThrow"]
:dev-http {8888 "classpath:public"}
:builds
{:main
{:target :browser