Leon --

> Sky asked me if anyone had done any simple benchmarks comparing JVM
> and PVM at this point. Now, I know we're still at an early stage and
> haven't really looked at speed, but a trivial counting and simple
> arithmetic benchmark:

Here's an implementation of the code in Jako. I haven't checked in
the version of the compiler that compiles it yet because there's a
patch that needs to be applied to the assembler first. I'm also
attaching the bench.pasm file the compiler generates.


Regards,

-- Gregor
 _____________________________________________________________________ 
/     perl -e 'srand(-2091643526); print chr rand 90 for (0..4)'      \

   Gregor N. Purdy                          [EMAIL PROTECTED]
   Focus Research, Inc.                http://www.focusresearch.com/
   8080 Beckett Center Drive #203                   513-860-3570 vox
   West Chester, OH 45069                           513-860-3579 fax
\_____________________________________________________________________/
#
# bench.jako
#
# Based on Bench.java posted to [EMAIL PROTECTED] by
# Leon Brocard <[EMAIL PROTECTED]> on 2001-09-15. Note that the
# only 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 presence of the 'end' statement at the...well...at the
#     end.
#
#   * The use of the variable n instead of the constant 10000
#     in the conditions of the while loops.
#
# Copyright (C) 2001 Gregor N. Purdy. All rights reserved.
# This program is free software. It is subject to the same
# license as Perl itself.
#

var int q =     1;
var int w =     1;
var int i =     1;
var int j =     1;

var int n = 10000;

while (q < n) {
  w = 1;

  while (w < n) {
    i++;
    j += i;
    w++;
#    print("$q, $w\n");
  }

  q++;
}

end

# This file produced by the Jako Compiler
#
# bench.jako
#
# Based on Bench.java posted to [EMAIL PROTECTED] by
# Leon Brocard <[EMAIL PROTECTED]> on 2001-09-15. Note that the
# only 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 presence of the 'end' statement at the...well...at the
#     end.
#
#   * The use of the variable n instead of the constant 10000
#     in the conditions of the while loops.
#
# Copyright (C) 2001 Gregor N. Purdy. All rights reserved.
# This program is free software. It is subject to the same
# license as Perl itself.
#

# q: I1
             set      I1, 1
# w: I2
             set      I2, 1
# i: I3
             set      I3, 1
# j: I4
             set      I4, 1

# n: I5
             set      I5, 10000

_W1_NEXT:    lt       I1, I5, _W1_REDO, _W1_LAST
_W1_REDO:
             set      I2, 1

_W2_NEXT:    lt       I2, I5, _W2_REDO, _W2_LAST
_W2_REDO:
             inc      I3
             add      I4, I4, I3
             inc      I2
#    print("$q, $w\n");
             branch   _W2_NEXT
_W2_LAST:

             inc      I1
             branch   _W1_NEXT
_W1_LAST:

             end     

Reply via email to