File tree Expand file tree Collapse file tree 3 files changed +22
-6
lines changed
Expand file tree Collapse file tree 3 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -10,3 +10,16 @@ lein do clean, test
1010lein javac
1111lein doo node test-build once
1212```
13+
14+ # Running benchmarks
15+ ## All benchmarks
16+ ```
17+ scripts/run-benchmarks
18+ ```
19+ ## Individual benchmark(s)
20+ Specify the benchmark names as command line args. They will likely each need quoted because they contain spaces.
21+ Order is ignored.
22+ ```
23+ scripts/run-benchmarks "prepend to a vector" "filter a sequence"
24+ ```
25+
Original file line number Diff line number Diff line change 1919 (println (pretty-float3 t) " \t\t " (pretty-float3 (/ t best-time 1.0 )) " \t\t " k))))
2020
2121(defmacro run-benchmark [name & exprs]
22- (let [afn-map (->> exprs shuffle (map (fn [e] [`(quote ~e) `(fn [] ~e)])) (into {}))]
23- `(do
24- (println " Benchmark:" ~name)
25- (compare-benchmark ~afn-map)
26- (println " \n ********************************\n " ))))
22+ (let [only-benchmarks (set (filter some? *command-line-args*))
23+ all-benchmarks? (empty? only-benchmarks)]
24+ (if (or all-benchmarks? (contains? only-benchmarks name))
25+ (let [afn-map (->> exprs shuffle (map (fn [e] [`(quote ~e) `(fn [] ~e)])) (into {}))]
26+ `(do
27+ (println " Benchmark:" ~name)
28+ (compare-benchmark ~afn-map)
29+ (println " \n ********************************\n " ))))))
2730
2831(defn specter-dynamic-nested-get [data a b c]
2932 (select-any (keypath a b c) data))
Original file line number Diff line number Diff line change @@ -5,4 +5,4 @@ lein version
55echo
66lein show-profiles bench
77echo
8- java -server -XX:MaxInlineSize=100 -cp " $( lein with-profile bench classpath) " clojure.main scripts/benchmarks.clj
8+ java -server -XX:MaxInlineSize=100 -cp " $( lein with-profile bench classpath) " clojure.main scripts/benchmarks.clj " $@ "
You can’t perform that action at this time.
0 commit comments