Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Varies in execution time for the FM

0 Kudos
527

Dear Experts, Please suggest for the below issue.. I am doing the performance improvement for the custom function module. Function module results are taking different different execution time for the same inputs (plant,storage location, yeare,from date and to date) for the same records(4356) that is some time 15 sec, other times 17sec,5 sec,140 sec etc. Could you please let me know why its taking different execution time for the same inputs and same records :4356. Thanks in advanced. Note : In this FM these tables mkpf and mseg are being used.

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor
410

It's a well-known issue that exact same data can lead to different performance because database can be busy or not, application server can be busy or not, the servers may buffer some data and the buffer may have been emptied or not.

The best solution to have the best measure possible is to run two tests consecutively, and take the second test. Of course, you will always get a varying duration. But optimizing the performance should bring you to a noticeable improvement so you don't need the exact duration (if it's more or less 10%, it's not worth spending time on it, unless you have a program running for hours).

2 REPLIES 2

Sandra_Rossi
Active Contributor
411

It's a well-known issue that exact same data can lead to different performance because database can be busy or not, application server can be busy or not, the servers may buffer some data and the buffer may have been emptied or not.

The best solution to have the best measure possible is to run two tests consecutively, and take the second test. Of course, you will always get a varying duration. But optimizing the performance should bring you to a noticeable improvement so you don't need the exact duration (if it's more or less 10%, it's not worth spending time on it, unless you have a program running for hours).

matt
Active Contributor
410

If your program is like this, it would explain it.

data(i) = random_number_between_1_and_4( ).
case i.
  when 1.
    wait up to 15 seconds.
  when 2.
    wait up to 17 seconds.
  when 3.
    wait up to 5 seconds.
  when 4.
    wait up to 140 seconds.
endcase.
select...

The point is, without you showing the important parts of your code, we cannot possibly tell you why it's not working as you'd like.