On 28/2/23 13:47, David Crayford wrote:

On 25/2/23 01:23, Farley, Peter wrote:
Python on the mainframe is pretty good, but still can't beat out Rexx in performance even when the Rex script needs to use BPXWUNIX and friends to access z/OS Unix file systems,


I have conducted a series of benchtests, and the results suggest that REXX is not as fast as Python. In my testing, I compare the performance of C, Lua, Python, and REXX, and the results are clear: C is the fastest, followed by Lua, which is within an order of magnitude of C. Python comes next, within an order of magnitude of Lua, and REXX consistently performs the poorest. In addition to the performance factor, the vast Python ecosystem compared to the limited options available for REXX also make it an easy decision. Python is also simpler to extend with packages, while REXX requires more effort and potentially complex steps, such as using modern libraries that require Language Environment (LE).


My benchtests

Lua

local file = assert(io.open(arg[1], "rb, type=record, noseek"))
while true do
   local rec = file:read()
   if not rec then break end
end

Python

import sys
from pyzfile import *
try:
   with ZFile(sys.argv[1], "rb,type=record,noseek") as file:
      for rec in file:
         pass
except ZFileError as e:
   print(e)

REXX

/* REXX */
  arg dsname
  address MVS
  call bpxwdyn "ALLOC FI(INPUT) DA("dsname") SHR"
  do until eof
    "EXECIO 10000 DISKR INPUT ( STEM rec."
    eof = (rc > 0)
  end
  "EXECIO 0 DISKR INPUT ( FINIS"

The results: Add user+system to get total CPU time

> time lua benchio.lua "//'CPA000.QADATA.PMR99999.SSA.HR1315PM'" && time python3 benchio.py "//'CPA000.QADATA.PMR99999.SSA.HR1315PM'" && time ./benchio.rex "CPA000.QADATA.PMR99999.SSA.HR1315PM"
real    0m47.019s
user    0m3.255s
sys     0m1.097s

real    1m0.710s
user    0m8.001s
sys     0m2.678s

real    1m17.772s
user    0m13.575s
sys     0m4.536s

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to