on 12-30-2019 9:16 AM
Dear Experts,
I would like to know which keyword is faster, foreach or where.
From blog https://blogs.sap.com/2015/08/27/sap-cloud-application-studio-performance-best-practices/ I understood where translates into for loop and therefore it is slower than foreach but from C# tutorial I understand for has better performance over foerach. This bring back again same question which one is faster.
Please let me know.
Regards
Rituraj
The Q&A in the blog post is a bit misleading in its phrasing: Yes, Where translates into a foreach + if statements. But it has the possibility of being optimized by the compiler later on. If you use foreach + ifs yourself it'll have the exact same performance without the chance of future optimization.
This is similar to C#. Worst case you get the same performance as doing the loop yourself, but chances are it'll get optimized. Chances are simply greater in C# because there are so many libraries already for it (like the Entity Framework).
WTB Library Integration and more direct Database Access for ABSL !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
8 | |
8 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.