Module benchmark

a tiny library for benchmark

Info:

  • License: MIT
  • Author: spacewander

Functions

Tms (args)

Create a Tms table. Tms contains below fields:

  • label, default ''
  • stime system CPU time, default 0.0
  • utime user CPU time, default 0.0
  • real wall time, default 0.0
  • total stime+utime

Usage:

     Tms{stime=2.0}
     => Tms{label='', stime=2.0, utime=0.0, total=2.0, real=0.0}
measure (func, label)
Returns the time used to execute the given function as a Tms table.
realtime (func)
Returns the elapsed real time used to execute the given function
bm (label_width, format, no_gc)
Return a reporter to report given benchmark cases. If no_gc is not false, it will stop GC while running cases. This reporter will reserve label_width leading spaces for labels on each line, and use format to format each line. format is a C-style format string like '%.3s\t%.3u\t%.3t\t%.3r', where '%s' means system, '%u' means user, '%t' means total, '%r' means real

Fields

FORMAT
default format
LABEL_WIDTH
default width of label
generated by LDoc 1.4.3 Last updated 2016-03-22 22:00:37