COBOL

COBOL

COBOL

COBOL is responsible for the efficient, reliable, secure, and unseen day-to-day operations of the world's economy.

 View Only
Expand all | Collapse all

COBOL 6.1 compiler performance

  • 1.  COBOL 6.1 compiler performance

    Posted Mon February 13, 2017 08:45 AM

    Hi!

    I am planning a migration from COBOL 4.2 to 6.1 (after attempting 5.1 and 5.2). I have applied the Dec 2016 APAR and I am running on a zBC12 machine. What I am seeing is a *huge* increase in compile time (both elapsed and cpu) for my test programs. Here are some 4.2 totals:

    SEG120I ------------------------------------------------------------------------
                            J o b   E n d   S t a t i s t i c s                     
                                                                                    
    Job  Name: BOXWELL5       System ID: Z100        Submit: 10-Feb-2017 10:53:06 PM
    Job JESID: JOB03759       MVS level: SP7.2.1     Start:  10-Feb-2017 10:53:06 PM
    Job Class: A                                     End:    10-Feb-2017 10:53:32 PM
    CPU (TCB): 00:00:22.54                           Storage below 16M:       8,928k
    CPU (SRB): 00:00:00.15                           Storage above 16M:   1,710,540k
    Trans Act: 00:00:26.01                           Service Units:           97,705
    Tape Mnts: 0                                     Total EXCPs:              8,214
                                                                                    
    ---------------Paging---------------        ---------------Paging---------------
    VIO In:                       10,773        VIO Out:                       9,106
    Pages In:                          0        Pages Out:                         0
    Common (LPA+CSA):                271        Hiperspace:                        0
    VIO Reclaims:                     20        Pages Stolen:                      0

    23 Secs CPU and 26 Secs elapsed. Run this now with the 6.1 Libs:

    SEG120I ------------------------------------------------------------------------
                            J o b   E n d   S t a t i s t i c s                     
                                                                                    
    Job  Name: BOXWELL5       System ID: Z100        Submit: 10-Feb-2017 10:36:08 PM
    Job JESID: JOB03758       MVS level: SP7.2.1     Start:  10-Feb-2017 10:36:08 PM
    Job Class: A                                     End:    10-Feb-2017 10:42:48 PM
    CPU (TCB): 00:06:22.55                           Storage below 16M:         900k
    CPU (SRB): 00:00:00.16                           Storage above 16M:     225,768k
    Trans Act: 00:06:39.43                           Service Units:       18,891,423
    Tape Mnts: 0                                     Total EXCPs:             22,593
                                                                                    
    ---------------Paging---------------        ---------------Paging---------------
    VIO In:                       13,276        VIO Out:                       9,782
    Pages In:                          0        Pages Out:                         0
    Common (LPA+CSA):                  7        Hiperspace:                        0
    VIO Reclaims:                     15        Pages Stolen:                      0

    I get six minutes added!! What can I have done wrong ?? VIO? Compile options are basic to say the least:

    //COMP    EXEC PGM=IGYCRCTL,REGION=0M,              
    //        PARM='OPTFILE'                            
    //SYSOPTF   DD DATA,DLM=$$                          
     APOST,BUF(32760),LC(0),OPT(1),NOSEQ,ARCH(10),
     TRUNC(BIN),BLOCK0                                                 
    $$                                                  
    //STEPLIB   DD DISP=SHR,DSN=IGY610.SIGYCOMP        

     

    * Statistics for COBOL program WLXPM100:                         
    *    Source records = 57196                                      
    *    Data Division statements = 8350                             
    *    Procedure Division statements = 23002                       
    *    Generated COBOL statements = 0                              
    *    Program complexity factor = 23056                           
    End of compilation 1,  program WLXPM100,  no statements flagged.
    Return code 0                                                   

     

    Not exactly a beast...

     

    Any ideas what I can change??

     

    Roy

     

     

     

    rldbox


  • 2.  Re: COBOL 6.1 compiler performance

    Posted Mon February 13, 2017 11:02 AM

    Hi Roy,

    Enterprise COBOL V5 and V6 range from 5 to 15 times slower than V4.2, on average. The reason for this is that V4.2 has a simplistic optimizer that only optimizes small chunks of the program at once, while V5 and V6 do many more optimizations than V4.2 did, and they optimize the program globally, looking at the entire program at once. V5 and V6 make a tradeoff, where increased compilation time leads to decreased execution time; for programs that are compiled infrequently but executed often, this provides significant savings.

    As you might expect, the higher the OPT level, the more optimizations the compiler does, so I'd expect to be hitting 15 times at OPT(2), not OPT(1). It does look like the compilation time here is excessive. There's nothing really that you can do to shorten that. In cases like this, there's often something about how a program is structured that causes the optimizer to spend longer compiling the program. My recommendation is that you open a PMR for this, and we'll be happy to take a look and do what we can to reduce compilation time.

     

    Thanks!

    Mike

    Mike Chase


  • 3.  Re: COBOL 6.1 compiler performance

    Posted Tue February 14, 2017 12:44 AM

    Hi!

     

    My firm is a Partner Developer with IBM so I cannot even open a PMR...

     

    Hmmm..

     

    Roy

    rldbox


  • 4.  Re: COBOL 6.1 compiler performance

    Posted Mon February 13, 2017 05:31 PM

    Did you happen to select INITCHECK as an installation-default compiler option?
     

    BillWoodger


  • 5.  Re: COBOL 6.1 compiler performance

    Posted Tue February 14, 2017 12:43 AM

    Thanks so far... Here are the complete compile time parameters:

     

    PP 5655-EC6 IBM Enterprise COBOL for z/OS  6.1.0 P161207
    Invocation parameters:                                  
     OPTFILE                                                
    Options from SYSOPTF:                                   
     APOST,BUF(32760),LC(0),OPT(1),NOSEQ,ARCH(10),          
     TRUNC(BIN),BLOCK0                                      
    Options in effect:                                      
     NOADATA                                                
       ADV                                                  
       AFP(VOLATILE)                                        
       APOST                                                
       ARCH(10)                                             
       ARITH(COMPAT)                                        
     NOAWO                                                  
       BLOCK0                                               
       BUFSIZE(32760)                                       
     NOCICS                                                 
       CODEPAGE(1140)                                       
     NOCOMPILE(S)                                           
     NOCOPYRIGHT                                            
     NOCURRENCY                                             
       DATA(31)                                             
       DBCS                                                 
     NODECK                                                 
     NODIAGTRUNC                                            
       DISPSIGN(COMPAT)                                     
     NODLL                                                  
     NODUMP                                                 
     NODYNAM                                                
     NOEXIT                                                 
     NOEXPORTALL                                            
     NOFASTSRT                                              
       FLAG(I,I)                                            
     NOFLAGSTD                                              
       HGPR(PRESERVE)                                       
     NOINITCHECK                                            
       INTDATE(ANSI)                                        
       LANGUAGE(EN)                                         
       LINECOUNT(0)                                         
     NOLIST                                                 
     NOMAP                                                  
       MAXPCF(60000)                                        
     NOMDECK                                                
     NONAME                                                

      NSYMBOL(NATIONAL)
    NONUMBER            
      NUMPROC(NOPFD)    
      OBJECT            
    NOOFFSET            
      OPTIMIZE(1)       
      OUTDD(SYSOUT)     
      PGMNAME(COMPAT)   
      QUALIFY(COMPAT)   
      RENT              
      RMODE(AUTO)       
    NORULES             
    NOSERVICE           
    NOSEQUENCE          
      SOURCE            
      SPACE(1)          
    NOSQL               
      SQLCCSID          
    NOSQLIMS            
    NOSSRANGE           
    NOSTGOPT            
      SUPPRESS          
    NOTERM              
    NOTEST(NODWARF)     
    NOTHREAD            
      TRUNC(BIN)        
    NOVBREF             
      VLR(STANDARD)     
      VSAMOPENFS(COMPAT)
    NOWORD              
      XMLPARSE(XMLSS)   
      XREF(FULL)        
    NOZONECHECK         
      ZONEDATA(PFD)     
      ZWB   
               

     

    I will do more compiles on a selection of different programs today and post my results.

    Roy

     

    Roy

    rldbox


  • 6.  Re: COBOL 6.1 compiler performance

    Posted Tue February 14, 2017 02:51 AM

    Thanks,

     

    I'd suggest AFP(NOVOLATILE) and HGPR(NOPRESERVE) unless you have some very unusual inter-language communication involved. That'll help, I have no idea of by how much.

    I asked about INITCHECK because there is a recent APAR. However, you don't.

    First time I've looked to see what the Program Complexity Factor means. Seems it means little more than the number of statements in the PROCEDURE DIVISION :-), and you are a little way over 1/3 of the default, so not exactly a beast in size...

     

    Do other programs, the more diffeent the better, react in the same way?

     

    What does this program do, that some other program doesn't? Lots of something? CALLs? Maths? SQL? Use of variable-length items (ODO or reference-modification with expressions resolved at run-time)? Lots FUNCTIONS?

    BillWoodger


  • 7.  Re: COBOL 6.1 compiler performance

    Posted Tue February 14, 2017 03:51 AM

    Hi Bill,

     

     The normal parameters I compile with are :

     APOST,BUF(32760),LC(0),OPT(1),NOSEQ,ARCH(10),OFFSET,
     TRUNC(BIN),BLOCK0,AFP(NOVOLATILE),HGPR(NOPRESERVE),
     RULES(NOEVENP,NOLXPRF,NOSLCKB)                     

    But because the compile time was horrendous I tried reducing to the bare minimum!

    I have now spend a happy few hours compiling 39 of our programs (including the top 18 with over 5000 lines of code), some batch, some online, some with DB2. All basic COBOL, no weirdness like XML or ODO, or functions... What I see is what is said - the average is 5.65 times more CPU with a few rogue programs where it goes up to extremes like in my example. But I only have two of these (from my 39) one at 16.8

    * Statistics for COBOL program MDB2R250:  
    *    Source records = 20232               
    *    Data Division statements = 3901      
    *    Procedure Division statements = 6431
    *    Generated COBOL statements = 0       
    *    Program complexity factor = 6518    

    and the 16.9 times (the original monster above). I think I can live with these "problem programs" !

    I will probably leave COBOL 4.2 as the normal compiler in development/test and then in the QA staging switch to COBOL 6 with OPT(1) before final test where it all gets tested again. Then we have the best of both worlds. At this time we do no need any of the new stuff in COBOL 5/6 it would just be nice to get a performance boost for "free" !

     

    Roy

     

    rldbox


  • 8.  Re: COBOL 6.1 compiler performance

    Posted Tue February 14, 2017 04:42 AM

    Thanks, I see what you mean. With HGPR and AFP I was thinking of run-times (compiler able to generate less code for one thing, to not save such stuff) but not the impact of the optimiser being able to say "hey, now I can use all this extra stuff. Lets. Get. Digging!".

    There is the OPT(0) route for development (only use higher outside of "program testing").

    Bear in mind that if developers are supporting the programs "up the line" and there are failures, the code generated is radically different with V5+. Maybe they need to get used to that?

    There's also the Automatic Binary Optimizer (ABO) route. Works on the executable, creates a new executable able to use a lot of post-ESA instructions unavailable to V4.2 and earlier. There's a free trial... even "in the cloud",

    I've not seen many V5+ compiles, but in your second example, that is the highest difference between Procedure Statements and Program Complexity Factor that I've seen. Lots of VALUE statements? Other than that and ODO, I can't find that anything else affects the PCF, but something in that program is.

    Perhaps Mike can give more on the science of PCF as calculated and reported?

    Is The Beast able to run to completion at OPT(2)?

     

     

    BillWoodger


  • 9.  Re: COBOL 6.1 compiler performance

    Posted Tue February 14, 2017 09:35 AM

    I can't recommend you do initial testing with V4.2 and then recompile and retest before deployment with V6. V5 and V6 introduced a new optimizer and code generator, which produces more efficient program, by using different instruction sequences to do the same work, but those instruction sequences may produce different results when used with invalid data.

    Our recommendation is that you do two rounds of testing: one with ZONECHECK, SSRANGE, and OPT(0) for maximum ability to debug and shortest compile time, and then another round of testing before deployment at OPT(2), NOZONECHECK, and NOSSRANGE, to get the best performance.

    You can get more detail in our COBOL Migration Workshop presentation; you can find previously-recorded presentations and slides here: https://ibm.box.com/v/COBOLMigrationWorkshops

    Mike Chase


  • 10.  Re: COBOL 6.1 compiler performance

    Posted Tue February 14, 2017 09:52 AM

    I would love to do that - I want to remove the COBOL 4.2 but at this time I see resistance in the developers! They argue that we should stick with COBOL 4.2 and not even try to go to 6.1... This is all very annoying and why it is sometimes 17 times more cpu and sometimes only 1.2 times is hard to explain to the developers who say, the code is all "the same" - Naturally the code is not the same but it is a bit like trying to herd cats...

    The developers then looked at the COBOL load library and started complaining that the problem was there as the lib is now huge in comparison to what it was...I will see if I can get my systems guys to put the library somewhere "better" and see what happens but naturally I bet it does not help!

    Ho hum... Perhaps I should rewrite it all in HLASM... >grin<

     

    Roy

    rldbox


  • 11.  Re: COBOL 6.1 compiler performance

    Posted Wed February 15, 2017 01:44 PM

    Something else you might want to look into is our Automatic Binary Optimizer product. It will take your pre-compiled COBOL binaries (V4.2 and earlier) and use the optimizing technology from the V5/V6 COBOL compiler to increase the performance of your existing modules. It also respects the behaviour of the original instruction sequences, so the invalid data issues I mention aren't a problem when using ABO.

    Mike Chase


  • 12.  Re: COBOL 6.1 compiler performance

    Posted Tue February 14, 2017 05:16 AM

    Compile the beast with OPT(2) and it gets much worse:

     

    SEG120I ------------------------------------------------------------------------
                            J o b   E n d   S t a t i s t i c s                     
                                                                                    
    Job  Name: BOXWELL5       System ID: Z100        Submit: 14-Feb-2017 10:57:16 AM
    Job JESID: JOB04126       MVS level: SP7.2.1     Start:  14-Feb-2017 10:57:17 AM
    Job Class: A                                     End:    14-Feb-2017 11:08:03 AM
    CPU (TCB): 00:10:16.32                           Storage below 16M:         900k
    CPU (SRB): 00:00:00.16                           Storage above 16M:     225,816k
    Trans Act: 00:10:46.07                           Service Units:       46,496,301
    Tape Mnts: 0                                     Total EXCPs:             22,674
                                                                                    
    ---------------Paging---------------        ---------------Paging---------------
    VIO In:                       13,270        VIO Out:                       9,843
    Pages In:                          0        Pages Out:                         0
    Common (LPA+CSA):                  0        Hiperspace:                        0
    VIO Reclaims:                     21        Pages Stolen:                      0

     

    676 Secs CPU !

    Impressive! And when I do a OPT(FULL) run in 4.2 it look like:

    Job  Name: BOXWELL5       System ID: Z100        Submit: 14-Feb-2017 11:13:40 AM
    Job JESID: JOB04127       MVS level: SP7.2.1     Start:  14-Feb-2017 11:13:41 AM
    Job Class: A                                     End:    14-Feb-2017 11:14:07 AM
    CPU (TCB): 00:00:22.04                           Storage below 16M:       8,928k
    CPU (SRB): 00:00:00.15                           Storage above 16M:   1,709,312k
    Trans Act: 00:00:25.22                           Service Units:           97,924
    Tape Mnts: 0                                     Total EXCPs:              7,094
                                                                                    
    ---------------Paging---------------        ---------------Paging---------------
    VIO In:                       10,358        VIO Out:                       9,082
    Pages In:                          0        Pages Out:                         0
    Common (LPA+CSA):                  0        Hiperspace:                        0
    VIO Reclaims:                     29        Pages Stolen:                      0

     

    22 secs... 30.7 times more... I just hope the code is 30 times faster!!!  LoL

     

    Roy

    rldbox