#
# bench.jako
#
# Based on Bench.java posted to perl6-internals@perl.org by
# Leon Brocard <acme@astray.com> 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: /mirror/trunk/languages/jako/examples/bench.jako 12840 2006-05-30T15:08:05.048089Z 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();

