In a recent Ask Ubuntu question on checking whether some files have differing content, I saw a comment stating that, if the differing sections didn't matter,
cmp would be faster than
diff. This Stack Overflow answer concurs, giving the reason that
cmp would stop at the first differing byte. However, GNU
diff has the
--brief) flag, which is supposed to make it
report only when files differ. It would seem logical that GNU
diff would also stop comparing once any difference is found (like
grep would stop searching after the first match when
-q is specified).
cmp truly faster than
diff -q, in the context of Linux systems, which are likely to have the GNU version?