‎2007 Jul 05 7:36 PM
Experts,
I have given list of report , that need to be optimized , my problem
is without understanding the logic of the program , If i start doing optimization
then it may change the overall behavior of the code , for example there may
be instance where loop within loop may be used , As said there may be repeated
records , hence read would have been avoided inside loop .
What is the best way to optimise code without trying to understand what code
is doing.
‎2007 Jul 05 7:39 PM
‎2007 Jul 05 7:41 PM
Hi,
Could you please post here your code? I will "try" to understand it..
Regards
‎2007 Jul 05 7:58 PM
‎2007 Jul 05 8:23 PM
I think your SELECTs are generally OK. I didn't look at them closely, but nothing jumped out at me.
One of your forms (populate_firm) has a nested loop in it. I think I would leave that until after fixing the next one:
The program does a number of
READ TABLE ZZZZZZ WITH KEY
F1 = Z1
F2 = Z2...
Try sorting these tables in the key filed order and then adding BINARY SEARCH to the READ statements. This will speed the program up and you don't really have to delve into the logic.
SORT ZZZZZZ by F1 F2.
READ TABLE ZZZZZZ WITH KEY
F1 = Z1
F2 = Z2...
BINARY SEARCH.
Rob
‎2007 Jul 06 12:34 PM
Hi sanju,
Rob said what you need to do.
Dont worry about long programs. You realy dont need to know exacty logic of the program, but you know what do you have to do: to optimize.
Try to execute the program in bug mode, or with break points, and verify parts of your program. You need to know where the program's performance is not good.
i have the same problem here, a report with poor performance but i dont know how to optimize because all technics were used and the performance is bad.
I expect you solve this problem,
regards
RP
‎2007 Jul 06 2:21 PM
I can't really help with optimizing the code in such cases, but I can offer an alternative suggestion: Buy a more powerful computer.
After all, if time is too costly to spend it on understanding the purpose of the code, hardware is probably cheap in comparison.
‎2007 Jul 06 2:32 PM
Well, I'm not so sure about that. If I went to management and told them that I couldn't understand some code and asked them to by new hardware instead, I think the money they would use to buy it would come from the money they save by not paying me any more.
Rob
‎2007 Jul 06 2:40 PM
Well, since the customer's (or company's) needs are the highest priority that isn't a problem, is it?
Anyway, I was thinking more along the lines of the management not wanting people to spend time figuring out the code, not people not being able to understand it.
But your answer was a good one anyway. Shows that there's always another angle from which things can be viewed. Have a good weekend
‎2007 Jul 06 2:47 PM
Hi,
Usually performance improvement takes places at 2 levels:
1) 'Quick Wins' , this is where you use SE30/ST05 to find the obvious problems and correct. Sometimes with badly written programs you can quickly ( less than a day) get some major improvements without knowing much, if anything, about what the program does.
2) 'Rewrites', this where you do need to understand what the program is supposed to do and look to see if there are any better alternatives. I've lost count of the number of programs involving reading BSEG that I've seen that need redesign.
‎2007 Jul 17 12:17 PM
Hi Sanju,
<b>I have actually worked on similiar case where performance optimization had to be done without going into the logic of report. So what I did for that was:</b>
used proper sorts on all the internal tables.
read table itab has to be done with binary search.
try to fetch data at once from DB .
try to work on internal tables as much as possible.
removed unnecessary looping on internal tables.
selecting the fields from DB table have to be in proper sequence. means ,,if in Db table matnr is before werks , then write select as
select matnr werks from...
and same case with conditions also
select * from DB table
where matnr = ''
and werks = '' .
Hope it helps.
reward points if useful
BR
Harmeet Singh.