Pudu programming language
Menu
API reference

Std.Bench.measure

1 declaration

fn

measure: Str -> Int -> Int -> fn() -> () -> Std.Bench.Sample

This is a callable function.

What it does

Run an action and answer how long each batch of it took.

The clock counts whole milliseconds, so an operation faster than that reads

as taking no time at all. batch is the answer: the action is run that

many times between two clock readings, and the report divides. A batch that

leaves the best reading at zero has not been made large enough, and

tooFast says so rather than letting a reader believe the zero.

The first batch is run and discarded. A first run pays for whatever the

program had not done yet, and including it would make every measurement a

measurement of that instead.

Read the signature

  • The text after the name is the type checked by Pudu.
  • Read arrows from left to right: inputs come first, and the final type is returned.

Back to Std.BenchSearch related declarations