A Clojure library for profiling.
(require '[cider.inlined-deps.profile.v0v5v2.profile.core :refer :all])
(defn my-add [a b] (+ a b))
(defn my-mult [a b] (* a b))
(profile-vars my-add my-mult)
(profile {}
(my-add (my-mult (rand-int 100000) (rand-int 1000000))
(my-mult (rand-int 100000) (rand-int 1000000))))
profile prints output to *err* using pprint/print-table; it
looks like this:
| :name | :n | :sum | :q1 | :med | :q3 | :sd | :mad |
|----------------+----+------+-----+------+-----+-----+------|
| #'user/my-add | 1 | 2µs | 2µs | 2µs | 2µs | 0µs | 0µs |
| #'user/my-mult | 2 | 11µs | 3µs | 8µs | 3µs | 3µs | 5µs |
A Clojure library for profiling.
## Example
```clojure
(require '[cider.inlined-deps.profile.v0v5v2.profile.core :refer :all])
(defn my-add [a b] (+ a b))
(defn my-mult [a b] (* a b))
(profile-vars my-add my-mult)
(profile {}
(my-add (my-mult (rand-int 100000) (rand-int 1000000))
(my-mult (rand-int 100000) (rand-int 1000000))))
```
`profile` prints output to `*err*` using `pprint/print-table`; it
looks like this:
```
| :name | :n | :sum | :q1 | :med | :q3 | :sd | :mad |
|----------------+----+------+-----+------+-----+-----+------|
| #'user/my-add | 1 | 2µs | 2µs | 2µs | 2µs | 0µs | 0µs |
| #'user/my-mult | 2 | 11µs | 3µs | 8µs | 3µs | 3µs | 5µs |
```cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |