It isn't! yes runs at 7.2 GiB/s on my macbook air.
Though I have Linux installed on it instead of Mac OS :)
Are you trolling? The commenter obviously meant the macOS version of "yes".
The VM subsystem is much slower. Also possibly a not-up-to-date GNU grep, on my (ancient) MBP I get 26MB "native", 780MB GNU and 2.8GB for TFA's C program (2.9 if I replace the malloc by a stack-allocated array, weirdly enough)
Probably alignment issues: stuff on the stack might be aligned by default, in contrast to malloc'd memory.
The CPU and RAM are slower and there is much more kernel overhead.
Not to mention pipe buffer size is small on OS X.
Come on people, I ran GNU yes just there, it isn't as slow as OP says but it is a quarter of expected performance.