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

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

micro-benchmark: it does actually not depend on numbers and random-bsd

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