   (doseq [{:keys [id result]} results]
     (println (report (:desc (test-map id)) result))) )
 
+(defn- mkdir [dir]
+  (.mkdirs (io/file dir))
+  (when (not (.exists (io/file dir)))
+    (str "Unable to create directory: " dir)))
+
 (def ^:private argspec
   [["-o" "--output FILE" "Output file" :default "bench.edn"]
    ["-h" "--help" "Show help"]
+   ["-l" "--load" "Load benchmark params from cache in ~/.benchmark"]
    ["-r" "--input FILE" "Read and print results from FILE"]
    ["-i" "--include TAG" "Run benchmarks with TAG (can be used multiple times)" :default [] :assoc-fn (fn [m k v] (update-in m [k] conj v))]]) 
 

        (:input options) (print-results (edn/read-string (slurp (:input options))))
        :else (let [xena (h2/create-xenadb dbfile)
                    results (atom [])]
                (doseq [{:keys [id desc params body]} (filter test-filter tests)]
                  (let [params (params)
                        result (apply body xena params)]
                    (swap! results conj {:id id :result result})
                    (println (report desc result))))
                (spit (:output options) (pr-str @results)))))

  `(let [start# (. System (nanoTime))]
     ~expr
     (/ (double (- (. System (nanoTime)) start#)) 1000000.0)))

(def dataset-map
  (into {} (map (fn [ds] [(:key ds) ds]) benchmark-data/datasets)))
