I was curious about the difference of GNU yes.c and OpenBSD yes.c.
I implemented both variants in Go. Here's my fastest variant with around 8 GiB data throughput per second. For the sake of completeness, a simple for {} loop like this:
for {
fmt.Println("y")
}
has a throughput of just 3-4 MiB per second.
git clone https://github.com/mnlwldr/yes
go run Main.go | pv -r > /dev/null
[8,10GiB/s]
You can install pv
from here.