From 73e9265f954528b6b2eccf98572e77126539a8df Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 23 Dec 2020 13:36:55 +0100 Subject: chore(3p/immer): Remove vendored copy of immer We ended up dropping the use of this library again. Change-Id: I2c44cd22a6128d23f87a582402bf5fb84991d608 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2292 Tested-by: BuildkiteCI Reviewed-by: Profpatsch --- .../immer/tools/clojure/src/immer_benchmark.clj | 131 --------------------- 1 file changed, 131 deletions(-) delete mode 100644 third_party/immer/tools/clojure/src/immer_benchmark.clj (limited to 'third_party/immer/tools/clojure/src') diff --git a/third_party/immer/tools/clojure/src/immer_benchmark.clj b/third_party/immer/tools/clojure/src/immer_benchmark.clj deleted file mode 100644 index f3d6f73e6c18..000000000000 --- a/third_party/immer/tools/clojure/src/immer_benchmark.clj +++ /dev/null @@ -1,131 +0,0 @@ -(ns immer-benchmark - (:require [criterium.core :as c] - [clojure.core.rrb-vector :as fv])) - -(defn h0 [& args] - (apply println "\n####" args)) - -(defn h1 [& args] - (apply println "\n====" args)) - -(defn h2 [& args] - (apply println "\n----" args)) - -(defn run-benchmarks [N S] - (h0 "Running benchmarks: N =" N " S =" S) - - (def c-steps 10) - - (defn vector-push-f [v] - (loop [v v - i 0] - (if (< i N) - (recur (fv/catvec (fv/vector i) v) - (inc i)) - v))) - - (defn vector-push [v] - (loop [v v - i 0] - (if (< i N) - (recur (conj v i) - (inc i)) - v))) - - (defn vector-push! [v] - (loop [v (transient v) - i 0] - (if (< i N) - (recur (conj! v i) - (inc i)) - (persistent! v)))) - - (defn vector-concat [v vc] - (loop [v v - i 0] - (if (< i c-steps) - (recur (fv/catvec v vc) - (inc i)) - v))) - - (defn vector-update [v] - (loop [v v - i 0] - (if (< i N) - (recur (assoc v i (+ i 1)) - (inc i)) - v))) - - (defn vector-update-random [v] - (loop [v v - i 0] - (if (< i N) - (recur (assoc v (rand-int N) i) - (inc i)) - v))) - - (defn vector-update! [v] - (loop [v (transient v) - i 0] - (if (< i N) - (recur (assoc! v i (+ i 1)) - (inc i)) - (persistent! v)))) - - (defn vector-update-random! [v] - (loop [v (transient v) - i 0] - (if (< i N) - (recur (assoc! v (rand-int N) i) - (inc i)) - (persistent! v)))) - - (defn vector-iter [v] - (reduce + 0 v)) - - (defn the-benchmarks [empty-v] - (def full-v (into empty-v (range N))) - (h2 "iter") - (c/bench (vector-iter full-v) :samples S) - (if (> N 100000) - (h2 "skipping updates 'cuz N > 100000 (would run out of mem)") - (do - (h2 "update!") - (c/bench (vector-update! full-v) :samples S) - (h2 "update-random!") - (c/bench (vector-update-random! full-v) :samples S) - (h2 "push!") - (c/bench (vector-push! empty-v) :samples S) - (h2 "update") - (c/bench (vector-update full-v) :samples S) - (h2 "update-random") - (c/bench (vector-update-random full-v) :samples S) - (h2 "push") - (c/bench (vector-push empty-v) :samples S)))) - - (defn the-rrb-benchmarks [empty-v] - (if (> N 1000) - (h2 "skipping relaxed test 'cuz N > 1000 (rrb-vector bug)") - (do - (def full-v (vector-push-f empty-v)) - (h2 "iter/f") - (c/bench (vector-iter full-v) :samples S) - (h2 "update/f") - (c/bench (vector-update full-v) :samples S) - (h2 "update-random/f") - (c/bench (vector-update-random full-v) :samples S))) - (def short-v (into empty-v (range (/ N c-steps)))) - (h2 "concat") - (c/bench (vector-concat empty-v short-v)) :samples S) - - (h1 "vector") - (the-benchmarks (vector)) - - (h1 "rrb-vector") - (the-benchmarks (fv/vector)) - (the-rrb-benchmarks (fv/vector))) - -(defn -main [] - (run-benchmarks 1000 100) - (run-benchmarks 100000 20) - (run-benchmarks 10000000 3)) -- cgit 1.4.1