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

Enterprise Cobol V5+ : TEST versus OPTIMIZE(2)

  • 1.  Enterprise Cobol V5+ : TEST versus OPTIMIZE(2)

    Posted Thu July 14, 2016 11:42 AM

    Hi,

    Starting with version V5 of Enterprise Cobol, is there an interest to use the OPTIMIZE(2) compilation option in the presence of the TEST compilation option, TEST(NOEJPD) or TEST(EJPD) ?

    These two options seem contrary objectives. For example:
    - OPTIMIZED(2) seeks to reorganize the binary code to make it more effective even if no longer meet bijective correspondence with the source statements, while TEST seeks to maintain at the level of the binary code bijective correspondence with the source statements.
    - OPTIMIZED(2) stores results of repeated expressions for reuse in the binary code of fallowing source instructions (especially on calculations of indices of access to items of tables : MOVE x TO TABLE-ITEM1(I +1), MOVE y TO TABLE-ITEM2 (I + 1)... ), then that TEST(EJPD) produces a binary code where these repeated expressions are re-evaluated for each source statement.

    What are the optimizations provided by the option OPTIMIZE(1|2) which are not cancelled by the option TEST(NOEJDP) or TEST(EJPD) ?

    Is there a consolidated document on the really active optimizations in the presence of the different variants and combination of options OPTIMIZE and TEST ?

    Thanks.

    Denis FALLAI

    DenisFALLAI


  • 2.  Re: Enterprise Cobol V5+ : TEST versus OPTIMIZE(2)

    Posted Thu July 14, 2016 12:16 PM

    Hi Denis,

    You're correct in saying that the TEST option limits some of the optimizations that the compiler is able to perform, and that the two are at odds with each other. The compiler does this by adding snapshot statements to its internal representation of the program; these snapshots prevent or limit some optimizations from transforming the code. The compiler does not explicitly check for the TEST option and use it to disable optimizations, though.

     

    We do not provide a list of all optimizations that the compiler performs, because a) many of the optimizations in V5/V6 require a good deal of in-depth compiler knowledge to understand (e.g. there's a lot more going on than, 'When we see these repeated patterns of COBOL code, do this transformation), and b) providing a public list of optimizations we do is giving away too much information to our competitors. As such, we also don't provide a list of the optimizations that are, and aren't, affected by TEST.

     

    When using both TEST and OPT(2), you will expect to see less performance gain than when using OPT(2) alone; I don't know how much (and it depends on the programs you have).

    Mike Chase


  • 3.  Re: Enterprise Cobol V5+ : TEST versus OPTIMIZE(2)

    Posted Thu August 04, 2016 07:17 PM

    It should also be noted (if it wasn't  already) EJPD is much worse for optimization than NOEJPD.  The snapshot concept that Mike mentioned is basically something like "pretend that you are going to do a DISPLAY UPON CONSOLE of every single data item at all statement boundaries."  That means that at statement boundaries the debugger can find all data items in a "sane state."    Adding EJPD is much worse because the generated code has to assume that any statement can effectively be reached from any other statement.  (Thus, for example, I can't have a data item in a register across statements 20 and 21 because control can arbitrarily jump to statement 20 from, for example, statement 10.)

    ahkielstra