Changeset 30893 in project


Ignore:
Timestamp:
05/18/14 11:58:17 (6 years ago)
Author:
certainty
Message:

micro-benchmark: documented benchmark-ips API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/micro-benchmark

    r30892 r30893  
    1313=== Introduction
    1414
    15 This egg provides means to benchmark your code in a simple manner.
     15This egg provides means to benchmark your code in a simple manner. It features traditional benchmarking with microsecond
     16resultion as well as a different approach that has been inspired by: https://github.com/evanphx/benchmark-ips
    1617
    1718
     
    2223(use micro-benchmark)
    2324
     25;; simply measure the runtime of the given fragment
    2426(benchmark-measure (sleep 2))
    2527
     
    2729(parameterize ((current-benchmark-iterations 3))
    2830  (benchmark-run (sleep 1)))
     31
     32;; find out how many iterations we can make per second
     33(benchmark-ips (sleep 2))
    2934</enscript>
    3035
     
    3439The amount of iterations that are used in '''benchmark-run'''. This defaults to 100.
    3540
    36 <syntax>(benchmark-measure ?code ...)</syntax>
     41<syntax>(benchmark-measure ?code)</syntax>
    3742Runs the '''?code''' once and returns the runtime in microseconds.
    3843
    39 <syntax>(benchmark-run [iterations] ?code ...)</syntax>
     44<syntax>(benchmark-run [iterations] ?code)</syntax>
    4045Runs the '''?code''' '''iterations''' times and returns an alist with the following keys:
    4146
     
    4651
    4752If '''iterations''' is not given then '''curren-benchmark-iterations''' is used.
     53
     54<syntax>(benchmark-ips [seconds] ?code)</syntax>
     55Determines how many times one can run the given '''?code''' per second and returns an alist with the following keys:
     56
     57* mean               - the mean amount iterations we can make per second
     58* standard-deviation - the sample standard deviation for the given iterations
     59
     60If '''seconds''' is not given then it defaults to 5.
    4861
    4962=== License
Note: See TracChangeset for help on using the changeset viewer.