((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/micro-benchmark" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.")) (section 2 "micro-benchmark" (toc) (section 3 "Repository" (p (link "https://bitbucket.org/certainty/micro-benchmark/overview"))) (section 3 "Authors" (p (int-link "/users/david-krentzlin" "David Krentzlin"))) (section 3 "Introduction" (p "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: " (link "https://github.com/evanphx/benchmark-ips"))) (section 3 "Examples" (highlight scheme "(use micro-benchmark)\n\n;; simply measure the runtime of the given fragment\n(benchmark-measure (sleep 2)) \n\n;; run code 3 times and return results\n(parameterize ((current-benchmark-iterations 3))\n  (benchmark-run (sleep 1)))\n\n;; find out how many iterations we can make per second\n(benchmark-ips (sleep 2))")) (section 3 "API" (def (sig (parameter "current-benchmark-iterations" (id current-benchmark-iterations))) (p "The amount of iterations that are used in " (b "benchmark-run") ". This defaults to 100.")) (def (sig (syntax "(benchmark-measure ?code)" (id benchmark-measure))) (p "Runs the " (b "?code") " once and returns the runtime in microseconds.")) (def (sig (syntax "(benchmark-run [iterations] ?code)" (id benchmark-run))) (p "Runs the " (b "?code") " " (b "iterations") " times and returns an alist with the following keys:") (ul (li "min - the minimum runtime of all iterations in microseconds") (li "max - the maximum runtime of all iterations in microseconds") (li "mean - the average runtime of all iterations in microseconds") (li "standard-deviation - the sample standard deviation for the given runtimes")) (p "If " (b "iterations") " is not given then " (b "curren-benchmark-iterations") " is used.")) (def (sig (syntax "(benchmark-ips [seconds] ?code)" (id benchmark-ips))) (p "Determines how many times one can run the given " (b "?code") " per second and returns an alist with the following keys:") (ul (li "mean               - the mean amount iterations we can make per second") (li "standard-deviation - the sample standard deviation for the given iterations")) (p "If " (b "seconds") " is not given then it defaults to 5."))) (section 3 "License" (pre "This program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or (at\nyour option) any later version.") (pre "This program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.") (pre "A full copy of the GPL license can be found at\n<http://www.gnu.org/licenses/>."))))