Fix map and structs benchmarks.

This commit is contained in:
Jorge Acereda 2019-09-20 23:40:05 +02:00
parent 21d539844d
commit 72f3189f25
2 changed files with 9 additions and 9 deletions

View File

@ -4,21 +4,21 @@
(defn insert []
(let [m {}]
(for [i 0 100]
(set! m (Map.put &m &i &1)))))
(Map.put! &m &i &1))))
(defn insert-collisions []
(let [m (Map.create-with-len 1)]
(for [i 0 100]
(set! m (Map.put &m &1 &1)))))
(Map.put! &m &1 &1))))
(def m (the (Map Int Int) {}))
(defn single-insert []
(set! m (Map.put &m &1 &1)))
(Map.put! &m &1 &1))
(defn setup-big-map []
(for [i 0 10000]
(set! m (Map.put &m &i &1))))
(Map.put! &m &i &1)))
(defn retrieve []
(Map.get &m &10))
@ -52,21 +52,21 @@
(defn insert-set []
(let [m (Set.create)]
(for [i 0 100]
(set! m (Set.put &m &i)))))
(Set.put! &m &i))))
(defn insert-set-collisions []
(let [m (Set.create-with-len 1)]
(for [i 0 100]
(set! m (Set.put &m &i)))))
(Set.put! &m &i))))
(def s (the (Set Int) (Set.create)))
(defn single-insert-set []
(set! s (Set.put &s &1)))
(Set.put! &s &1))
(defn setup-big-set []
(for [i 0 10000]
(set! s (Set.put &s &i))))
(Set.put! &s &i)))
(defn contains-set []
(Set.contains? &s &10))

View File

@ -8,7 +8,7 @@
(defn creation [] (Point.init 0 0))
(defn bench-access [] (ignore (Point.x &p))) ;; The name 'access' collides with an existing C-function.
(defn set [] (Point.set-x @&p 5))
(defn update [] (Point.update-x @&p Int.inc))
(defn update [] (Point.update-x @&p &Int.inc))
(defn main []
(do