View previous topic :: View next topic
|
Author |
Message |
babuprasad.g
New User
Joined: 20 Apr 2007 Posts: 1 Location: Denmark
|
|
|
|
Hi,
How can we reduce the MIPS Consumption in PL/1 & DB2 Code.What are the possible ways to reduce atleast 0.5 %.
Best Regards |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
Reduce the number of instructions executed.
Reduce the number of rows processed.
Use proper numeric definitions.
Talk with your performance measurement people and see if there is a tool in use that will identify which parts of the code use the most cpu time. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Use a better algorithm, cache values retrieved from DB2, get rid of all "conversion will be done by library call" warnings, use fixed bin(31) for loops and not PICs. Remove invariant code from loops.
But most importantly, use better algorithms! |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
As Dick and Prino alluded to, try to avoid data type conversions. For math operations, use the same data types. Whenever possible avoid float and packed types unless the data you are working with is already in that format. Maybe I should restrict that to say use FIXED BIN for all program control, indices, etc.
The same thing goes for Character operations. Avoid unnecessary conversions from numeric to character types. Find the most efficient means to do things like concatenation. Sometimes that means writing a small, specialized assembler routine to do something common.
Compile without runtime checks where appropriate.
Avoid external library calls when possible, at least for trivial tasks.
Cache data in memory rather than make repetitive reads.
And as has already been said several times, before you do any of this, see if your algorithm can be improved. It doesn't matter how you use a programming language if the algorithm is bad. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
How can we reduce the MIPS Consumption in PL/1 & DB2 Code.What are the possible ways to reduce atleast 0.5 %. |
Misconception number one: you want to reduce CPU consumption (presumably) since MIPS is (a) not typically referenced for individual programs, and (b) not a very good way to measure since it typically is not available without using specialized tools. And note that even when IBM was using MIPS, the workload being measured included cpu usage, input/output to disk and tape, and otherwise represented the entire machine -- not just CPU time.
Misconception number two: reducing the CPU time 0.5% is worth taking the time to look at. Unless the job is taking a lot of CPU time (i.e., running for literally days not hours at a time), you're not going to save enough time to make any significant difference. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Change of algorithm, executed statements:
Code: |
NAT_SCAN 481,904,272 97.2656% - original algorithm
NAT_SCAN 74,634 0.4819% - new algorithm
|
No amount of fiddling using the old algorithm would have allowed the original code to come even close to using a new algorithm... |
|
Back to top |
|
|
|