#
# 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-2003 Gregor N. Purdy. All rights reserved.
# This program is free software. It is subject to the same
# license as the Parrot interpreter.
#
# $Id: bench.jako,v 1.3 2003/09/19 04:20:27 gregor Exp $
#

use sys;

const int N = 1000;
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");

