Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go-yes

yes command written in Go

Installation

$ go install github.com/mattn/go-yes/cmd/yes@latest

Benchmark

Output goes through vmsplice(2) (zero-copy) when stdout is a pipe, which makes it roughly 2.2x faster than GNU yes:

$ yes | dd of=/dev/null bs=1M count=10240 iflag=fullblock
10737418240 bytes (11 GB, 10 GiB) copied, 1.19094 s, 9.0 GB/s

$ ./yes | dd of=/dev/null bs=1M count=10240 iflag=fullblock
10737418240 bytes (11 GB, 10 GiB) copied, 0.527356 s, 20.4 GB/s

Measured on Linux (WSL2). Numbers vary by kernel and machine. On non-Linux platforms (or when stdout is not a pipe) it falls back to plain write(2).

Windows has no vmsplice equivalent, so the only lever there is the block size: 256 KiB instead of the 64 KiB default gives about 1.7x (5.2 -> 8.8 GB/s piped between two processes on the same machine), which lands near GNU yes on WSL2 but still roughly 2x behind the vmsplice path.

License

MIT

Author

Yasuhiro Matsumoto (a.k.a. mattn)

About

yes command written in Go

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages