At first sight, both the statements ( loop at itab where <key> = <val> ; loop at itab. if <key> = <val>. ) looks like performing the same task.
But when it comes to performance, both beats each other in there own domain.
It all comes down to number of “‘matches” in the WHERE/IF-clause.
In case you have a rare match, the WHERE-method is better.
In case you have an always match, the IF-method is better.
When the match was done on 1-out-1000:
When the match was done at 1 – out of -2 :
and when the “match” is matching every line
*source = Harry Dietz