Welcome! Please see the About page for a little more info on how this works.

0 votes
in data.int-map by
As discussed previously in https://github.com/ztellman/immutable-int-map/pull/1

I note that the existing Seq implementation is not lazy, so i've just implemented a basic reverse iterator around this rather than walking the tree right-first - I was actually fairly surprised core clojure doesn't provide Reversible for ArrayLists already.

Patch taken from https://github.com/glenjamin/data.int-map/tree/rseq attached, benchmarks below:


user=> (require '[clojure.data.benchmark :refer (entries)]
  #_=>          '[clojure.data.int-map :as i]
  #_=>          '[criterium.core :as c])
nil
user=>

user=> (let [m (into (i/int-map) entries)]
  #_=>   (println "seq")
  #_=>   (c/quick-bench (dorun (seq m)))
  #_=>   (println "rseq")
  #_=>   (c/quick-bench (dorun (rseq m))))
seq
WARNING: Final GC required 8.9263203426305 % of runtime
WARNING: Final GC required 48.03202811726098 % of runtime
Evaluation count : 12 in 6 samples of 2 calls.
             Execution time mean : 75.794581 ms
    Execution time std-deviation : 421.571821 µs
   Execution time lower quantile : 75.476998 ms ( 2.5%)
   Execution time upper quantile : 76.483561 ms (97.5%)
                   Overhead used : 2.127421 ns

Found 1 outliers in 6 samples (16.6667 %)
    low-severe     1 (16.6667 %)
 Variance from outliers : 13.8889 % Variance is moderately inflated by outliers
rseq
WARNING: Final GC required 54.64906330819225 % of runtime
Evaluation count : 6 in 6 samples of 1 calls.
             Execution time mean : 101.840831 ms
    Execution time std-deviation : 723.601456 µs
   Execution time lower quantile : 100.881998 ms ( 2.5%)
   Execution time upper quantile : 102.496873 ms (97.5%)
                   Overhead used : 2.127421 ns


CLA has been signed.

1 Answer

0 votes
by
Reference: https://clojure.atlassian.net/browse/DIMAP-1 (reported by alex+import)
...