Time to build a vector of size 100000 = 2349000.0 microseconds
Time per entry: 23.49 microseconds
Time to perform 1000 updates = 1940000.0 microseconds
Time per update: 1940.0 microseconds
So in 2 milliseconds we can (partially) deserialize a vector with a million items, update an entry in that vector, and then reserialize the vector.
Here's the code:
(ns aatree.vector-updates
(:require [aatree.core :refer :all])
(:import (java.nio ByteBuffer)))
(def vector-size 1000000)
(def updates 1000)
(println)
(def t0 (System/currentTimeMillis))
(def lazy-vector (reduce conj emptyLazyAAVector (range vector-size)))
(def t1 (System/currentTimeMillis))
(def micr-0 (* 1000. (- t1 t0)))
(println "Time to build a vector of size" vector-size "=" micr-0 "microseconds")
(println "Time per entry:" (/ micr-0 vector-size) "microseconds")
(defn upd [v i]
(let [v1 (assoc v i (- i))
bb (ByteBuffer/allocate (lazy-byte-length v1))]
(lazy-write v1 bb)
(.flip bb)
(load-aavector bb)))
(println)
(def t0 (System/currentTimeMillis))
(def lazy-vector (reduce upd lazy-vector (range updates)))
(def t1 (System/currentTimeMillis))
(def micr-0 (* 1000. (- t1 t0)))
(println "Time to deserialize/update/reserialize " updates "times =" micr-0 "microseconds")
(println "Time per complete update:" (/ micr-0 updates) "microseconds")
(println)
next up: why? :-)
--
You received this message because you are subscribed to the Google Groups "AgileWikiDevelopers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to agilewikidevelo...@googlegroups.com.
To post to this group, send email to agilewiki...@googlegroups.com.
Visit this group at http://groups.google.com/group/agilewikidevelopers.
For more options, visit https://groups.google.com/d/optout.
Time to build a map of size 1000000 = 2.0032E7 microsecondsTime per entry: 20.032 microsecondsTime to deserialize/update/reserialize 1000 times = 3.0838E7 microsecondsTime per complete update: 30838.0 microseconds