(measured args-fn f)(measured args-fn f expr-fn)(measured args-fn f expr-fn warmup-args-fn)Return a Measured for a function that can be benchmarked.
The Measured is the basic unit of measurement. A Measured consists of
a state generation funtion and a function to be measured. The
function to be measured takes the result of calling the state function
and an eval-count as arguments, ie. (f (args-fn) eval-count), and
returns an [elapsed-time expr-value] tuple.
The state function is used to prevent constant folding for constant inputs.
The eval-count allows usage where the function is a wrapper that evaluates the subject expression multiple times.
expr-fn, if specified, returns a symbolic representation of the measured, for inspection purposes (unused internally).
warmup-args-fn, if specified, provides arguments for warmup phase instead of args-fn. This allows warmup with more varied inputs to get more representative JIT optimization.
Return a Measured for a function that can be benchmarked. The Measured is the basic unit of measurement. A Measured consists of a state generation funtion and a function to be measured. The function to be measured takes the result of calling the state function and an eval-count as arguments, ie. `(f (args-fn) eval-count)`, and returns an `[elapsed-time expr-value]` tuple. The state function is used to prevent constant folding for constant inputs. The eval-count allows usage where the function is a wrapper that evaluates the subject expression multiple times. expr-fn, if specified, returns a symbolic representation of the measured, for inspection purposes (unused internally). warmup-args-fn, if specified, provides arguments for warmup phase instead of args-fn. This allows warmup with more varied inputs to get more representative JIT optimization.
(measured-callable f)(measured-callable args-f f)(measured-callable args-f f warmup-args-fn)(measured-expr* expr options env)Return a measured function for the given expression.
The arguments are converted into a vector, which is used as an argument to the a function that wraps the expression.
Any expr that is not a List is treated as a constant. This is mainly for internal benchmarking.
The env parameter is the macro's &env, used to identify local bindings. Local bindings are captured at the call-site and passed through the measurement pipeline alongside hoisted constants.
Options: :time-fn - Custom timing function :warmup-args-fn - Function to generate arguments for warmup phase
Return a measured function for the given expression. The arguments are converted into a vector, which is used as an argument to the a function that wraps the expression. Any expr that is not a List is treated as a constant. This is mainly for internal benchmarking. The env parameter is the macro's &env, used to identify local bindings. Local bindings are captured at the call-site and passed through the measurement pipeline alongside hoisted constants. Options: :time-fn - Custom timing function :warmup-args-fn - Function to generate arguments for warmup phase
(measured? x)Predicate for x being a Measured.
Predicate for x being a Measured.
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 |