source: project/wiki/eggref/4/micro-benchmark @ 30886

Last change on this file since 30886 was 30886, checked in by certainty, 7 years ago

micro-benchmark: documented API changes

File size: 1.8 KB
Line 
1== micro-benchmark
2[[toc:]]
3
4=== Requirements
5[[/egg/random-bsd|random-bsd]], [[/egg/numbers|numbers]]
6
7
8=== Repository
9
10[[https://bitbucket.org/certainty/micro-benchmark/overview]]
11
12
13=== Authors
14[[/users/david-krentzlin|David Krentzlin]]
15
16
17=== Introduction
18
19This egg provides means to benchmark your code in a simple manner.
20
21
22
23=== Examples
24
25<enscript highlight=scheme>
26(use micro-benchmark)
27
28(benchmark-measure (sleep 2))
29
30;; run code 3 times and return results
31(parameterize ((current-benchmark-iterations 3))
32  (benchmark-run (sleep 1)))
33</enscript>
34
35=== API
36
37<parameter>current-benchmark-iterations</parameter>
38The amount of iterations that are used in '''benchmark-run'''. This defaults to 100.
39
40<syntax>(benchmark-measure ?code ...)</syntax>
41Runs the '''?code''' once and returns the runtime in microseconds.
42
43<syntax>(benchmark-run [iterations] ?code ...)</syntax>
44Runs the '''?code''' '''iterations''' times and returns an alist with the following keys:
45
46* min - the minimum runtime of all iterations in microseconds
47* max - the maximum runtime of all iterations in microseconds
48* mean - the average runtime of all iterations in microseconds
49* standard-deviation - the sample standard deviation for the given runtimes
50
51If '''iterations''' is not given then '''curren-benchmark-iterations''' is used.
52
53=== License
54 This program is free software: you can redistribute it and/or modify
55 it under the terms of the GNU General Public License as published by
56 the Free Software Foundation, either version 3 of the License, or (at
57 your option) any later version.
58
59 This program is distributed in the hope that it will be useful, but
60 WITHOUT ANY WARRANTY; without even the implied warranty of
61 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
62 General Public License for more details.
63
64 A full copy of the GPL license can be found at
65 <http://www.gnu.org/licenses/>.
Note: See TracBrowser for help on using the repository browser.