1; 2; mops.scheme 3; 4; A Scheme implementation of the mops.pasm example program, 5; for speed comparisons. 6; 7; Example command line: 8; 9; umb-scheme mops.scheme 10; 11; NOTE: 1,000,000 iterations used instead of 100,000,000 12; to keep thing from bogging down too much. 13; 14; Copyright (C) 2001-2005, Parrot Foundation. 15; This program is free software. It is subject to the same 16; license as Parrot. 17; 18; 19; 20 21(let ((I1 0) (I2 0) (I3 1) ; set I2, 0 22 (N1 0) (N2 0) (N4 0) ; set I3, 1 23 (N5 0) (I4 1000000) ; set I4, 1000000 24 (I5 0)) ; 25(display "Iterations: ") ; print "Iterations: " 26(display I4) ; print I4 27(newline) ; print "\n" 28 ; 29(set! I1 2) ; set I1, 2 30(set! I5 (* I4 I1)) ; mul I5, I4, I1 31 ; 32(display "Estimated ops: ") ; print "Estimated ops: " 33(display I5) ; print I5 34(newline) ; print "\n" 35 ; 36(set! N1 (time)) ; time N1 37 ; 38(define (loop n) ; REDO: 39 (if (not (= n 0)) ; sub I4, I4, I3 40 (loop (- n 1)))) ; if I4, REDO 41(loop I4) ; 42 ; DONE: 43(set! N5 (time)) ; time N5 44 ; 45(set! N2 (- N5 N1)) ; sub N2, N5, N1 46 ; 47(display "Elapsed time: ") ; print "Elapsed time: " 48(display N2) ; print N2 49(newline) ; print "\n" 50 ; 51(set! N1 I5) ; iton N1, I5 52(set! N1 (/ N1 N2)) ; div N1, N1, N2 53(set! N2 1000000.0) ; set N2, 1000000.0 54(set! N1 (/ N1 N2)) ; div N1, N1, N2 55 ; 56(display "M op/s: ") ; print "M op/s: " 57(display N1) ; print N1 58(newline) ; print "\n" 59 ; 60) ; end 61 62