tools/dev/bench_op.pir - Benchmark one or more opcodes
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
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).
Run the given opcode(s) in a loop N time. If no --times options is given 100.000 is used.
Set --verbose to 1 to see the total time. Set --verbose to 2 to see the compiled programs.
Execute the given opcodes in front of the loop. This is needed for ops, that have side effects like newclass.
Print a short description and exit.
Print program version and exit.
You can't use the variables i and N nor the labels loop: and _entry\d in your opcodes.
Leopold Toetsch <firstname.lastname@example.org>