TITLE

bench_op - Benchmark one or more opcodes

SYNOPSIS

  parrot bench_op.pir 'add $I0, $I1, $I2'
  parrot bench_op.pir --preops='newclass $P0, "Foo"' file_w_ops.pir
  parrot bench_op.pir --help

DESCRIPTION

The given opcode(s) are compiled into a sequence:

  .sub _entry0
    .param int N
    .local int i
    #
    # preops go here
    #
    null i
  loop:
    #
    # ops go here
    #
    inc i
    lt i, N, loop
  .end

so they should conform to Parrot Calling Conventions. The code gets executed with the PIR compiler - using symbolic variables is always ok.

Output is the time in seconds for 1.000.000 instruction(s).

OPTIONS

--times=N
Run the given opcode(s) in a loop N time. If no --times options is given 100.000 is used.
--verbose=i
Set --verbose to 1 to see the total time. Set --verbose to 2 to see the compiled programs.
--preops='opcode(s)'
Execute the given opcodes in front of the loop. This is needed for ops, that have side effects like newclass.
--help
Print a short description and exit.
--version
Print program version and exit.

BUGS

You can't use the variables i and N nor the labels loop: and _entry\d in your opcodes.

AUTHOR

Leopold Toetsch <lt@toetsch.at>