#!/usr/bin/rexx /*----------------------------------------------------------------------------*/ /* */ /* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ /* Copyright (c) 2005, 2006 Rexx Language Association. All rights reserved. */ /* Copyright (c) 1981, 2011 Mike Cowlishaw. All rights reserved. */ /* */ /* This program and the accompanying materials are made available under */ /* the terms of the Common Public License v1.0 which accompanies this */ /* distribution. A copy is also available at the following address: */ /* http://www.oorexx.org/license.html */ /* */ /* Redistribution and use in source and binary forms, with or */ /* without modification, are permitted provided that the following */ /* conditions are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the distribution. */ /* */ /* Neither the name of Rexx Language Association nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ /* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ /* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ /* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*----------------------------------------------------------------------------*/ /* 1.0 17 Jan 1989 Original version (Mike Cowlishaw) */ /* 2.0 3 Jun 1989 Remove attempt to simulate commands */ /* 2.1 7 Oct 1989 Remove use of not symbols, and correct commentary */ /* 12 Aug 2011 Restore lost comments + minor cleanups */ /*----------------------------------------------------------------------------*/ /* This measure of Rexx execution speed is based on an analysis of */ /* the dynamic mix of clauses found in a (subjectively chosen) */ /* collection of Rexx programs (including commands, macros, and */ /* personal programs). Approximately 2,500,000 lines of trace */ /* output were analysed, and the program below recreates the */ /* dynamic mix of constructs found in that analysis. */ /* In view of the dramatic differences between systems in their */ /* efficiency of issuing commands, the timed loop does not issue */ /* commands (an 'RC=expression; PARSE' sequence is used instead). */ /* This program therefore measures the performance of a Rexx */ /* implementation, exclusive of command execution overhead. */ /* Elapsed (user-perceived) time is used, rather than any form of */ /* virtual time. */ /*----------------------------------------------------------------------------*/ rexxcps=2.1 /* REXXCPS version; quotable only if code unchanged */ /* Adjust these counts so run-time is about one second */ count=100 /* Repetition count */ averaging=100 /* Averaging-over count */ tracevar='Off' /* Trace setting (for development use) */ signal on novalue parse source source 1 system . parse version version say '----- REXXCPS' rexxcps '-- Measuring REXX clauses/second -----' say ' REXX version is:' version say ' System is:' system say ' Averaging:' averaging 'measures of' count 'iterations' /* Calibrate for the empty do-loop */ empty=0 do i=1 to averaging call time 'R' do count; end empty=time('R')+empty end empty=empty/averaging noterm=(system='CMS'); if pos('O',tracevar)=1 then noterm=0 if noterm then do say 'Calibration (empty DO):' empty 'secs (average of' averaging')' say 'Spooling trace NOTERM' 'CP SPOOL CON * START NOTERM'; 'CP CLOSE CON PUR' end /* Now the true timer loop .. average timing again */ full=0 do i=1 to averaging trace value tracevar call time 'R' do count; /* ----- This is first of the 1000 clauses ----- */ flag=0; p0='b' do loop=1 to 14 /* This is the "block" comment in loop */ key1='Key Bee' acompound.key1.loop=substr(1234"5678",6,2) if flag=acompound.key1.loop then say 'Failed1' do j=1.1 to 2.2 by 1.1 /* executed 28 times */ if j>acompound.key1.loop then say 'Failed2' if 17