Stampa
Cobol e varie

This is a simple cobol benchmark for evaluate the compiler performance.

These results with Opencobol 1.1 binary package on a Intel(R) Core(TM)2 Duo CPU E7500 @2.93.Ghz 3,24 GB RAM XP Pro Service pack 3

Opencobol GCC 3.4.5 Gary's version (It was built using Berkeley Database V5.0.26, GMP V5.0.1 and PDCurses V4.3.

Elapsed time 00 min:00 sec: 00 hundredths 27 for COMPUTE
Elapsed time 00 min:00 sec: 00 hundredths 83 for UNSTRING
Elapsed time 00 min:00 sec: 00 hundredths 39 for STRING
Elapsed time 00 min:00 sec: 00 hundredths 37 for WRITE
Elapsed time 00 min:00 sec: 00 hundredths 03 for READ
Elapsed time 00 min:00 sec: 00 hundredths 30 for DELETE
Elapsed time 00 min:00 sec: 02 hundredths 19 for COMPLETE TEST

 

Opencobol  Microsoft Visual Express C++ 2008 (built from me using the opencobol.org tarball with VISAM BMP and PDCurses kindly received from Human.

Elapsed time 00 min:00 sec: 00 hundredths 32 for COMPUTE
Elapsed time 00 min:00 sec: 00 hundredths 42 for UNSTRING
Elapsed time 00 min:00 sec: 00 hundredths 29 for STRING
Elapsed time 00 min:00 sec: 00 hundredths 18 for WRITE
Elapsed time 00 min:00 sec: 00 hundredths 06 for READ
Elapsed time 00 min:00 sec: 00 hundredths 28 for DELETE
Elapsed time 00 min:00 sec: 01 hundredths 55 for COMPLETE TEST

 

Feel free to use it with your cobol compiler and Opencobol then upload here the results with a comment!.

 

000000 IDENTIFICATION DIVISION.
000000 PROGRAM-ID. BENCH01.
000000*
000000* BENCHMARK for COBOL ...
000000*
000000* Copyright (C) 2010-2012 Federico Priolo T&P Soluzioni Informatiche Srl
000000*                         Questo indirizzo e-mail è protetto dallo spam bot. Abilita Javascript per vederlo.
000000*
000000* This program is free software; you can redistribute it and/or modify
000000* it under the terms of the GNU General Public License as published by
000000* the Free Software Foundation; either version 2, or (at your option)
000000* any later version.
000000*
000000* This program is distributed in the hope that it will be useful,
000000* but WITHOUT ANY WARRANTY; without even the implied warranty of
000000* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
000000* GNU General Public License for more details.
000000*
000000* You should have received a copy of the GNU General Public License
000000* along with this software; see the file COPYING.  If not, write to
000000* the Free Software Foundation, 51 Franklin Street, Fifth Floor
000000* Boston, MA 02110-1301 USA
000000*
000000*
000000*---------------------------------------------------------------------
000000 ENVIRONMENT DIVISION.
000000 CONFIGURATION SECTION.
000000 SOURCE-COMPUTER.        PC-IBM.
000000 OBJECT-COMPUTER.        PC-IBM.
000000 SPECIAL-NAMES.
000000
000000     DECIMAL-POINT IS COMMA.
000000
000000 INPUT-OUTPUT SECTION.
000000 FILE-CONTROL.
000000
000000          SELECT ARK-BENCH ASSIGN TO "bench01.dat"
000000           ORGANIZATION IS INDEXED
000000           ACCESS MODE  IS  DYNAMIC
000000           RECORD KEY   IS  CHIAVE-BENCH
000000           FILE STATUS  IS STATUS-BENCH.
000000
000000 DATA DIVISION.
000000
000000 FILE SECTION.
000000
000000 FD ARK-BENCH.
000000 01 REC-BENCH.
000000   02 CHIAVE-BENCH.
000000    05 KEY-BENCH              PIC 9(9).
000000   02 DATI-BENCH              PIC X(119).
000000
000000*
000000 WORKING-STORAGE SECTION.
000000 01 STATUS-BENCH              PIC XX   VALUE "00".
000000 01 XTIMES                    PIC 9(7) VALUE 1000000.
000000 01 XRECORD                   PIC 9(7) VALUE 10000.
000000 01 NUMTEST                   PIC 99   VALUE ZEROS.
000000 01 MAXTEST                   PIC 99   VALUE 6.
000000 01 ORARIO-TIME.
000000         02 ORA-TIME          PIC 99.
000000         02 MIN-TIME          PIC 99.
000000         02 SEC-TIME          PIC 99.
000000         02 CEN-TIME          PIC 99.
000000
000000*-----------------------------------------------------------------
000000 77 INIZIO                    PIC 9(9)V99 VALUE ZEROS.
000000 77 FINE                      PIC 9(9)V99 VALUE ZEROS.
000000 77 ORARIO                    PIC 9(9)V99 VALUE ZEROS.
000000 77 INIZIO1                   PIC 9(9)V99 VALUE ZEROS.
000000 77 FINE1                     PIC 9(9)V99 VALUE ZEROS.
000000 77 SECONDI                   PIC 9(9)    VALUE ZEROS.
000000 77 CENTESIMI                 PIC 9(9)V99 VALUE ZEROS.
000000 77 MINUTI                    PIC 9(9)    VALUE ZEROS.
000000 77 ORE                       PIC 9(9)    VALUE ZEROS.
000000 77 INSTRUCTION               PIC X(30)   VALUE SPACE.
000000
000000 01 BIG                       PIC S9(9)V9(7)
000000                              VALUE 987654321,8554469.
000000
000000 01 STRING1   PIC X(512) VALUE ALL "FEDERICO PRIOLO".
000000 01 STRING2                  PIC X(512) VALUE SPACES.
000000 01 STRING3                  PIC X(512) VALUE SPACES.
000000
000000*-----------------------------------------------------------------
000000 PROCEDURE DIVISION.
000000*-----------------------------------------------------------------
000000*MAIN SECTION.
000000
000000         PERFORM VARYING NUMTEST FROM 1 BY 1
000000           UNTIL NUMTEST > MAXTEST
000000
000000          PERFORM GET-TIME       THRU EX-GET-TIME
000000          MOVE ORARIO            TO INIZIO
000000
000000          IF INIZIO1 = ZEROS
000000          MOVE ORARIO            TO INIZIO1
000000          END-IF
000000
000000**** single test here
000000
000000          EVALUATE NUMTEST
000000            WHEN 4 MOVE "WRITE "  TO INSTRUCTION
000000            PERFORM WRITE-TEST    THRU EX-WRITE-TEST
000000            WHEN 5 MOVE "READ  "  TO INSTRUCTION
000000            PERFORM READ-TEST     THRU EX-READ-TEST
000000            WHEN 6 MOVE "DELETE"  TO INSTRUCTION
000000            PERFORM DELETE-TEST   THRU EX-DELETE-TEST
000000          END-EVALUATE
000000
000000**** multiples
test here
000000
000000          PERFORM XTIMES         TIMES
000000
000000           EVALUATE NUMTEST
000000            WHEN 1 MOVE "COMPUTE" TO INSTRUCTION
000000            PERFORM COMPUTE-TEST  THRU EX-COMPUTE-TEST
000000            WHEN 2 MOVE "UNSTRING" TO INSTRUCTION
000000            PERFORM UNSTRING-TEST THRU EX-UNSTRING-TEST
000000            WHEN 3 MOVE "STRING"  TO INSTRUCTION
000000            PERFORM STRING-TEST   THRU EX-STRING-TEST
000000           END-EVALUATE
000000
000000
000000           END-PERFORM
000000
000000           PERFORM GET-TIME       THRU EX-GET-TIME
000000           MOVE    ORARIO         TO FINE1
000000           PERFORM DO-RESULT      THRU EX-DO-RESULT
000000
000000          END-PERFORM.
000000
000000          MOVE INIZIO1           TO INIZIO
000000          MOVE FINE1             TO ORARIO
000000          MOVE "COMPLETE TEST"   TO INSTRUCTION
000000
000000          PERFORM DO-RESULT      THRU EX-DO-RESULT
000000
000000
000000          STOP RUN.
000000
000000 COMPUTE-TEST.
000000
000000          COMPUTE BIG = BIG / 123456,78.
000000
000000 EX-COMPUTE-TEST.
000000           exit.
000000
000000 UNSTRING-TEST.
000000
000000          MOVE SPACES            TO STRING2.
000000          MOVE SPACES            TO STRING3.
000000
000000          UNSTRING STRING1 DELIMITED BY "RICO"
000000           INTO STRING2 STRING3.
000000
000000 EX-UNSTRING-TEST.
000000          EXIT.
000000
000000 WRITE-TEST.
000000
000000          OPEN OUTPUT ARK-BENCH.
000000
000000          PERFORM VARYING KEY-BENCH FROM 1 BY 1 UNTIL
000000           KEY-BENCH > XRECORD
000000
000000             ACCEPT ORARIO-TIME FROM TIME
000000
000000             MOVE ORARIO-TIME TO DATI-BENCH
000000
000000              WRITE REC-BENCH
000000               INVALID KEY CONTINUE
000000              END-WRITE
000000
000000          END-PERFORM.
000000
000000          CLOSE ARK-BENCH.
000000
000000
000000 EX-WRITE-TEST.
000000          EXIT.
000000
000000 READ-TEST.
000000
000000          OPEN INPUT ARK-BENCH.
000000
000000          PERFORM VARYING KEY-BENCH FROM 1 BY 1 UNTIL
000000           KEY-BENCH > XRECORD
000000
000000              READ ARK-BENCH KEY IS CHIAVE-BENCH
000000               INVALID KEY CONTINUE
000000              END-READ
000000
000000          END-PERFORM.
000000
000000          CLOSE ARK-BENCH.
000000
000000 EX-READ-TEST.
000000          EXIT.
000000
000000 DELETE-TEST.
000000
000000          OPEN I-O   ARK-BENCH.
000000
000000          PERFORM VARYING KEY-BENCH FROM 1 BY 1 UNTIL
000000           KEY-BENCH > XRECORD
000000
000000              DELETE ARK-BENCH
000000               INVALID KEY CONTINUE
000000              END-DELETE
000000
000000          END-PERFORM.
000000
000000          CLOSE ARK-BENCH.
000000
000000 EX-DELETE-TEST.
000000          EXIT.
000000
000000 STRING-TEST.
000000
000000          MOVE "FEDERICO"        TO STRING2.
000000          MOVE "PRIOLO"          TO STRING3.
000000
000000          STRING STRING2 DELIMITED BY "RICO"
000000           STRING3 DELIMITED BY SIZE INTO STRING1.
000000
000000 EX-STRING-TEST.
000000          EXIT.
000000
000000 GET-TIME.
000000
000000          ACCEPT ORARIO-TIME FROM TIME.
000000
000000          COMPUTE ORARIO ROUNDED  = ( ORA-TIME * 3600 )  +
000000                                    ( MIN-TIME * 60   )  +
000000                                      SEC-TIME           +
000000                                    ( CEN-TIME / 100  ).
000000
000000 EX-GET-TIME.
000000          EXIT.
000000
000000 SET-TIME.
000000
000000          MOVE ORARIO TO SECONDI.
000000          MOVE ZEROS  TO MINUTI ORE.
000000
000000          DIVIDE SECONDI BY 60
000000           GIVING MINUTI REMAINDER SECONDI.
000000
000000          IF MINUTI > 60
000000           DIVIDE MINUTI BY 60
000000            GIVING MINUTI REMAINDER ORE.
000000
000000          COMPUTE CENTESIMI = SECONDI - ORARIO
000000
000000          COMPUTE CENTESIMI = CENTESIMI * 100
000000
000000          MOVE CENTESIMI         TO CEN-TIME.
000000          MOVE ORE               TO ORA-TIME.
000000          MOVE MINUTI            TO MIN-TIME.
000000          MOVE SECONDI           TO SEC-TIME.
000000
000000 EX-SET-TIME.
000000          EXIT.
000000
000000 DO-RESULT.
000000
000000          MOVE ORARIO            TO FINE.
000000
000000          COMPUTE ORARIO =  FINE - INIZIO.
000000
000000          PERFORM SET-TIME       THRU EX-SET-TIME.
000000
000000          DISPLAY "Elapsed time " ORA-TIME " min:"  MIN-TIME
000000           " sec: " SEC-TIME " hundredths " CEN-TIME
000000            " for " INSTRUCTION.
000000
000000
000000 EX-DO-RESULT.
000000          EXIT.