Skip to content

Instantly share code, notes, and snippets.

@arnaudbos
Created November 10, 2020 08:01
Show Gist options
  • Save arnaudbos/15ba894286ac4f90f01c667b872da816 to your computer and use it in GitHub Desktop.
Save arnaudbos/15ba894286ac4f90f01c667b872da816 to your computer and use it in GitHub Desktop.
[clj] Combine bench and profiling
(require '[clj-async-profiler.core :as prof] '[criterium.core :as bench])
(prof/profile {:return-file true}
(bench/bench
(merge {:a 1} {:b 2})))
; Execution time mean : 284.172365 ns
; /tmp/clj-async-profiler/results/03-cpu-flamegraph.svg
(prof/profile {:return-file true}
(bench/bench
(into {:a 1} {:b 2})))
; Execution time mean : 323.373109 ns
; /tmp/clj-async-profiler/results/04-cpu-flamegraph.svg
@arnaudbos
Copy link
Author

Screen Shot 2020-11-10 at 9 03 28 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment