-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
let CIs also benchmark the solutions
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
(ns solutions-benchmark | ||
(:require | ||
[criterium.core :as c] | ||
[clojure.string :as str] | ||
[clojure.pprint :as pp] | ||
aoc | ||
day01 day02 day03 day04 day05 | ||
day06 day07 day08 day09 day10 | ||
day11 day12 day13 day14 day15 | ||
day16 day17 day18 day19 day20 | ||
day21 day22 day23 day24 day25)) | ||
|
||
|
||
(defn extract-time [res] | ||
(->> res | ||
str/split-lines | ||
second | ||
(drop-while #(not (#{\:} %))) | ||
rest | ||
str/join)) | ||
|
||
(def results (atom [])) | ||
|
||
(def first-day 1) | ||
(def last-day 25) | ||
|
||
(doseq [i (range first-day (inc last-day))] | ||
(println "BENCHMARKING DAY" i) | ||
(let [res (with-out-str | ||
(c/quick-bench ((eval (symbol (format "day%02d" i) "solve")) (aoc/read-file i))))] | ||
(println res) | ||
(swap! results conj {:day i :time (extract-time res)})) | ||
(println "\n\n\n")) | ||
|
||
|
||
(println "SUMMARY:\n") | ||
(pp/print-table @results) |