This egg provides means to benchmark your code in a simple manner. It features traditional benchmarking with microsecond resolution as well as a different approach that has been inspired by: https://github.com/evanphx/benchmark-ips
(use micro-benchmark) ;; simply measure the runtime of the given fragment (benchmark-measure (sleep 2)) ;; run code 3 times and return results (parameterize ((current-benchmark-iterations 3)) (benchmark-run (sleep 1))) ;; find out how many iterations we can make per second (benchmark-ips (sleep 2))
- current-benchmark-iterations parameter
The amount of iterations that are used in benchmark-run. This defaults to 100.
- (benchmark-measure ?code) syntax
Runs the ?code once and returns the runtime in microseconds.
- (benchmark-run [iterations] ?code) syntax
Runs the ?code iterations times and returns an alist with the following keys:
- min - the minimum runtime of all iterations in microseconds
- max - the maximum runtime of all iterations in microseconds
- mean - the average runtime of all iterations in microseconds
- standard-deviation - the sample standard deviation for the given runtimes
If iterations is not given then curren-benchmark-iterations is used.
- (benchmark-ips [seconds] ?code) syntax
Determines how many times one can run the given ?code per second and returns an alist with the following keys:
- mean - the mean amount iterations we can make per second
- standard-deviation - the sample standard deviation for the given iterations
If seconds is not given then it defaults to 5.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A full copy of the GPL license can be found at <http://www.gnu.org/licenses/>.