View previous topic :: View next topic |
Author |
Message |
kirank Beginner
Joined: 21 Apr 2004 Posts: 61 Topics: 33 Location: hyderabad
|
Posted: Tue Apr 08, 2008 11:42 pm Post subject: Regarding Initialization |
|
|
Hi,
We are working on a requirement where we need to reduce the cpu consuming time of a program. The program is taking a long time during Intialization.
The program contians cobol table and the data is loading into the table. Every time when the loop begins(perform para) the variables(all are alphanumeric data type) of the table are getting initialized and that initialization is taking more cpu time. This we found through Strobe report.
After that we just removed initialization and we directly 'moved spaces to group variable' and again tested(This we've done by taking inputs from experts). Surprisingly the cpu consuming time got reduced.
Could you please let me know why this is happened? As per my knowledge it is most comfortable to use Intialization than moving.
Regards,
Kiran. |
|
Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Wed Apr 09, 2008 12:40 am Post subject: |
|
|
In assembler terms, it is all moves. I'm sure there is some COBOL compiler implementation detail that someone will point out, like initialize does each variable individually, or uses external runtime routines or uses some inefficient storage reference pattern or something similar, but if you really want the answer in this specific case, look at the generated assembler (probably a LIST compiler option - I don't know COBOL, let alone the idiosyncrasies of the compiler). Also, most IBM compilers have a "programmer's guide" that has this type of performance/best practices information. Sometimes it is buried in the language references manuals instead. _________________ New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html. |
|
Back to top |
|
 |
haatvedt Beginner
Joined: 14 Nov 2003 Posts: 66 Topics: 0 Location: St Cloud, Minnesota USA
|
Posted: Thu Apr 10, 2008 4:46 pm Post subject: |
|
|
Kirank,
I would suggest that you take the original code and compile it with the "LIST" option to see the generated assembler code. then do the same with the new version. I suspect that the difference is the looping through the table and initializing each field in the table.
a better technique is to modify the program so as to not require the table initialization at all. one way to do this is to check and see if either a SEARCH or SEARCH ALL verb is used. Also you need to check and see if you are doing some type of direct index access. If you're not using direct index access then you can use OCCURS DEPENDING ON variable-name when declaring the table. then add 1 to the variable name when loading the table. (you have to set the variable name to zero instead of initializing the table, also set the index to +1).
I always try to avoid array initialization if possible. This depends on how the table / array is accessed in the program
good luck
ps.. i do performance tuning for a living. _________________ Chuck Haatvedt
email --> clastnameatcharterdotnet
(replace lastname, at, dot with appropriate
characters) |
|
Back to top |
|
 |
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Thu May 15, 2008 10:25 am Post subject: |
|
|
Hi Kirank,
If you have to init the table and it's done many times , init a "model" table that is identical to your working table. Then whenever the working table requires an init, move the model table to the working table at the 01 level.
This should reduce a good deal of the o'head. _________________ Regards, Jack.
"A problem well stated is a problem half solved" -- Charles F. Kettering |
|
Back to top |
|
 |
|
|