DL
(let [path (into [] (take 1000000 (repeatedly #(rand-int 100))))
x 101
a (time (cond-> path
(nil? (some #(== x %) path)) (conj x)))
b (time (into [] (dedupe) (conj path x)))])
"Elapsed time: 62.1621 msecs"
"Elapsed time: 43.835101 msecs"
Size: a a a
DL
(let [path (into [] (take 1000000 (repeatedly #(rand-int 100))))
x 101
a (time (cond-> path
(nil? (some #(== x %) path)) (conj x)))
b (time (into [] (dedupe) (conj path x)))])
"Elapsed time: 62.1621 msecs"
"Elapsed time: 43.835101 msecs"
ST
ST
((
(defn add-to-vec [values value]
(let [size (count values)]
(loop [i 0
found false
acc (vector)]
(if (= i size)
(if (false? found)
(conj acc value)
acc)
(let [x (nth values i)]
(recur (inc i) (or found (= x value)) (conj acc x)))))))
ИФ
DL
DL
AC
ИФ
ST
ИФ
ИФ
ST
AC
RS
RS
IG
ST
AC
AC