04-14-2016 10:13 AM
Hi Experts,
As per i have analysed, move corresponding is working faster than move statement but in sap forum it is mentioned move statement is faster, so please any one help on this performance wise, as am using move corresponding inside the loop of 600000 records.
04-14-2016 10:17 AM
What's your question in detail? If MOVE is faster or MOVE-CORRESPONDING?
04-14-2016 10:28 AM
04-14-2016 10:39 AM
In your case, I guess. In general MOVE should be faster because it does not need to find the corresponding fields.
04-14-2016 10:42 AM
Hi Koushik,
MOVE: means from move one field to other , and the field names may be different
MOVE-CORRESPONDING means both the field names in both sides are to be same.then only we use this.
MOve-Corresponding is more convinient than moving fileds individually. but this command takes more CPU time this result in poor performance.
Regards,
E.Ananthachari.
04-14-2016 11:13 AM
Don't use Move-corresponding inside the loop, move each fields separately.
As above mentioned move-corresponding checks field name between two structures to move contents to respective fields. This hampers performance. Using Move will directly transfers the value without bothering about field names.
04-14-2016 12:03 PM
But what if you have 20 fields. Then that would be 20 times a move statement. Wouldn't move corresponding be faster (only one statement to do by abap).
I don't know the answer, just a question that pops up reading this discussion.
By the way I almost always use move-corresponding and never had any performance issues . If I have a perfomance issue it is because of other statements. Maybe I am just lucky ?
04-14-2016 12:24 PM
Well, I can imagine that 20 single moves are not as good as one move corresponding, because I guess the kernal can execute the single statement quicker than the 20 statements (depending on the huge of the structure). But if there is one move statement against one move corresponding statement, the first should win the race in general.
But to improve the performance the first question should be: Can I avoid the moving (copying)?
04-14-2016 12:35 PM
when you need to move maximum fields from one structure to another, then you can go for Move-Corresponding. But only for couple of fields, Move is preferable.
04-15-2016 5:17 PM
Pranay Patel wrote:
when you need to move maximum fields from one structure to another, then you can go for Move-Corresponding. But only for couple of fields, Move is preferable.
Where exactly do you get this information from? Can you please enlighten us with the source?
04-16-2016 6:38 AM
Pranay Patel wrote:
...
As above mentioned move-corresponding checks field name between two structures to move contents to respective fields. This hampers performance. Using Move will directly transfers the value without bothering about field names.
Does it? Can you prove it? If it's true for old versions, is it true for newer ones? Really, this is just a subjective opinion. See my post below for how the internals could be optimised.
The OP finds move-corresponding is faster. So long as he's tested correctly, why should we doubt that with unsubstantiated theory?
04-14-2016 11:24 AM
As per i have analysed ??
Could you please tell us how you analysed the statements move and move-corresponding ?
Refer below links
https://help.sap.com/abapdocu_70/en/ABAPMOVE-CORRESPONDING.htm
04-15-2016 1:55 PM
Hi Pradeep,
i have used move-corresponding inside the loop and work area contains 16 fields and structure of both work area is same.... it takes less time compare to individual 16 move statements.
04-15-2016 2:01 PM
Why do you use 16 individual moves, if the structure is the same and you can do it with one move? So, if you want a real comparison between MOVE (or 😃 and MOVE-CORRESPONDING use in both cases one statement.
04-14-2016 12:56 PM
Move corresponding may be faster but this is risky. This can be used if you are sure that every field name and corresponding data type is correct. Move for me is the safest way.
04-16-2016 6:34 AM
It is safer, but there's a trade-off perhaps of readability. However, in 7.4 onwards you can have the best of both worlds using CORRESPONDING operator with MAPPING.
04-14-2016 1:06 PM
But folks... The MOVE is considered obsolete (on SAP_ABA 7.4), instead it should use the equal sign. Of course the user who opened the issue not said component version SAP_ABA he is using, yet I think much better to use the = sign of what to do the MOVE command.
About MOVE-CORRESPONDING (still talking about 7.4), we have other ways of doing, and not think it's bad performance.
04-15-2016 3:30 PM
Both are pretty efficient memory operations, so I wouldn't worry about performance. If that's your only concern, you're a mighty good troop of ABAPers.
However, from a maintenance perspective I prefer move-corresponding. You can add a field to the structure or table and it is automatically transported in memory (if you design your code well).
Wolfgang
04-15-2016 4:03 PM
Hi,
Move corresponding is better when you had more fields inside the loop.
Regards
Raj
04-15-2016 4:57 PM
I'm a little surprised that this is still being asked. Many years ago, we were taught not to use MOVE-CORRESPONDING because it was less efficient for the kernel to analyze and perform. In the intervening time, hardware became much quicker but programming costs increased, so MOVE-CORRESPONDING became much more widely accepted. I don't know if newer releases handle this statement more efficiently or not.
Rob
04-16-2016 6:33 AM
The internals may well be more efficient with all kinds of optimisation. For example, perhaps the interpreter is smart enough to buffer the mapping so it's done only once between two object structures, and the actual moves are done in a single operation, then move-corresponding now may be faster than a bunch of moves.
If the OP has run his tests several times and got the same result that move-correspdoning is faster than move alone, then that's what he's got.
Certainly not something I'd worry about.
04-16-2016 8:10 PM
You're right (again) Matt
I ran a small test of a table with 10 fields. MOVE-CORRESPONDING ran in about 56% of the time as 10 MOVEs.
Rob
04-16-2016 6:40 AM
If you find that one particular way is faster than another, then that's what you've found and to heck with theory!
But you need to know you've tested it properly. Run the program five times with move-corresponding and take the average timing of the last four runs. Do the same witih move. Compare results.
If the results are less than 10% difference, then nothing has been demonstrated, and you should do whichever you consider the best programming.
04-18-2016 5:13 AM