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: 
Read only

performance query

Former Member
0 Likes
646

Moderator message: please use a more meaningful subject in future

Hi,

I've a internal table it_po with structure as follows,

po no , po item , vendor , quantity.

I want to get unique list of vendors in another internal table it_vendors from above table. Kindly suggest me which approach is better,

1. Declare it_vendors containg only one field vendor.

loop at it_po.

append all vendors found in table it_vendors

endloop.

sort it_vendors by vendor code.

delete adjacent duplsicates from it_vendors comparing vendor code.

2. declare it_vendors with structre same as it_po.

it_vendors[] = it_po[].

sort it_vendors by vendor code.

delete adjacent duplsicates from it_vendors comparing vendor code.

First approach will consume less memory as it has less no. of fields .

second approach will execute fast.

Kindly advice.

Edited by: Matt on Feb 4, 2009 1:25 PM

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
626

Hello Mac,

First approach will consume less memory as it has less no. of fields .

second approach will execute fast.

You have answered one-half of your question. I dont think having 10-15 extra fields doesnot cost you much memory.

My personal opinion is: "Execution time should be less" )

Awaiting other replies.

BR,

Suhas

6 REPLIES 6
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
627

Hello Mac,

First approach will consume less memory as it has less no. of fields .

second approach will execute fast.

You have answered one-half of your question. I dont think having 10-15 extra fields doesnot cost you much memory.

My personal opinion is: "Execution time should be less" )

Awaiting other replies.

BR,

Suhas

Read only

Former Member
0 Likes
626

Hi,

Follow the 2nd approach. It'll be better than first one.

Read only

Former Member
0 Likes
626

well in general whenever we talk of performance. its always trade off between memory and execution time and we always choose to save execution time. so no need to have second thoughts about it.

кu03B1ятu03B9к

Read only

Former Member
0 Likes
626

From performance point of view definitely approach 2 would be better...

Read only

rejish_balakrishnan
Contributor
0 Likes
626

HI ,

I would like you to advise to follow second option .Since there is a orderly manner of deleting duplicates in it .

(In business point of view a same vendor can be there at 2 places since the material that was procurred from him will be for different work center or added for diff cost center ..

In COMPARING ADDITION please provide some more key fields to have a narrow values .)

Read only

Former Member
0 Likes
626

Either first or Second ,

Because if your Logic Continues further and fetches more data u should go for one which consumes less memory.

If Your data is not huge, then go for the one whcih executes faster.

After all u r searching for overall performance ,not only to this block of code act accordingly.