# 빠른 yes 터미널 명령어 만들어보기

> Clean Markdown view of GeekNews topic #7018. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=7018](https://news.hada.io/topic?id=7018)
- GeekNews Markdown: [https://news.hada.io/topic/7018.md](https://news.hada.io/topic/7018.md)
- Type: news
- Author: [alstjr7375](https://news.hada.io/@alstjr7375)
- Published: 2022-07-21T19:50:11+09:00
- Updated: 2022-07-21T19:50:11+09:00
- Original source: [endler.dev](https://endler.dev/2017/yes/)
- Points: 8
- Comments: 1

## Topic Body

1. `yes`명령어 란?  
  - 문자 `y`를 반복적으로 출력하는 스트림  
2. 간단한 구현  
  - GOTO나 루프문으로 `y`를 반복적으로 출력하면 끝  
3. 간단한 성능 향상  
  - 버퍼 사용  
  - 버퍼 크기는 4의 배수 (메모리 정렬을 위해)  
4. 대용량에서 빠르게  
  - 루프에 재사용 될 채워진 문자열 버퍼 사용  
  - stdout은 잠금 상태로 보호  
  - 플랫폼 네이티브 문자열과 std::borrow::Cow로 불필요한 할당 피하기

## Comments



### Comment 11359

- Author: coremaker
- Created: 2022-07-21T19:58:38+09:00
- Points: 1

일종에 매크로군요?
