print_timing(input,
matchers,
count=10,
count_compile=None,
best_of=3,
parse_all=False,
out=None,
reference=None)
| source code
|
Generate timing information for the given input and parsers.
`input` can be a sequence or a function that generates sequences (this is
useful if you need to subvert caching). Note that a function is evaluated
once before the timing starts.
`matchers` is a dict that maps names to matchers. The names are used in
the output. Alternatively, a single matcher can be given (which will be
called "default"). A typical use might look like:
matcher = ....
time("...", {'default': matcher.clone().config.default().matcher,
'clear': matcher.clone().config.clear().matcher})
`count` is the number of parses to make when measuring a single time. This
is to make sure that the time taken is long enough to measure accurately
(times less that 10ms or so will be imprecise). The final time reported
is adjusted to be for a single parse, no matter what the value of `count`.
By default 10 matches are made.
`count_compile` allows a different `count` value for timing when the
compiler parser is not re-used. By default this is the same as `count`.
`best_of` repeats the test this many times and takes the shortest result.
This corrects for any slow-down caused by other programs running.
`parse_all`, if True, evaluates all parses through backtracking (otherwise
a single parse is made)
`out` is the destination for the printing (stdout by default).
`reference` names the matcher against which others are compared. By
default any matcher called "default" will be used; otherwise the first
matcher when sorted alphabetically is used.
|