# # bench.jako # # Based on Bench.java posted to perl6-internals@perl.org by # Leon Brocard on 2001-09-15. Note that the # only substantive differences between the Java version and the # Jako version are: # # * 'var int ...' vs 'int ...' for variable declaration. # # * The commented-out print line (which is simpler in Jako). # # * The use of the named constant N (value 100) instead of # the literal constant 10000 in the conditions of the while # loops. # # Copyright (C) 2001-2005, The Perl Foundation # This program is free software. It is subject to the same # license as the Parrot interpreter. # # $Id: bench.jako 12840 2006-05-30 15:08:05Z coke $ # use sys; const int N = 1000; sub bench() { var int q = 1; var num start_time; start_time = sys::timen(); while (q < N) { var int i, j, w = 1; while (w < N) { i++; j += i; w++; # sys::print("$q, $w\n"); } q++; } var num end_time; end_time = sys::timen(); var num elapsed; elapsed = end_time - start_time; sys::print("Elapsed: $elapsed\n"); } bench();