Skip to Content
효율적인 Go
book

효율적인 Go

by Bartlomiej Plotka
May 2025
Beginner to intermediate
502 pages
8h
Korean
O'Reilly Media, Inc.
Content preview from 효율적인 Go

부록 A. 냅킨 수학 계산의 지연 시간

다른 수준에서 최적화를 설계하고 평가하려면 컴퓨터와의 상호 작용에서 볼 수 있는 기본 작업의 지연 시간을 대략적으로 파악하고 대략적인 수치를 구할 수 있으면 유용합니다.

이러한 수치 중 일부를 기억하고 있으면 좋겠지만, 기억하지 못하는 경우를 위해 표 A-1에 대략적인 평균 지연 시간을 반올림한 작은 표를 준비했습니다. 이 표는 Simon Eskildsen의 냅킨 수학 리포지토리에서 많은 영감을 받았으며 약간의 수정을 가했습니다.

리포지토리는 2021년에 생성되었습니다. CPU 기반 작업의 경우, 해당 수치는 제온 제품군의 서버 x86 CPU를 기준으로 합니다. 매년 상황이 개선되고 있지만 대부분의 수치는 "하드웨어는 점점 더 빠르고 저렴해지고 있습니다"에 설명된 제한 사항으로 인해 2005년 이후 안정적인 수치라는 점에 유의하세요 . CPU 관련 지연 시간은 다양한 CPU 아키텍처(예: ARM)에 따라 다를 수 있습니다.

마지막으로, 이러한 수치는 디스크 쓰기 또는 읽기 지연 시간과 같이 소규모에서는 재현이 불가능한 경우가 많다는 점을 기억하세요. 새 버전의 운영 체제 및 드라이버가 탑재된 새 PC, 서버, 노트북 제공업체(예: Apple)는 광범위한 디스크 캐싱을 통해 환상적인 성능을 발휘합니다. 대용량 RAM과 결합하면 단일 또는 다중 MB 파일을 읽는 마이크로 벤치마크로 SSD 또는 HDD의 "느린" 지연 시간을 재현하는 데 약간의 노력이 필요합니다. 또한 일부 장치에는 지연 문제를 완화하기 위해 쓰기와 읽기를 여러 개의 디스크로 분할하는 하드웨어 RAID가 내장되어 있습니다. 즉, 실제로는 디스크에 직접 액세스하는 것보다 더 많은 계층이 관련되어 있습니다.

표 A-1. CPU 관련 지연 시간
운영 지연 시간 처리량

3 Ghz CPU 클럭 주기

0.3ns

N/A

CPU 레지스터 액세스

0.3ns(1주기)

N/A

CPU L1 캐시 액세스

0.9ns(3주기)

N/A

CPU L2 캐시 액세스

3ns

N/A

순차 메모리 R/W(64바이트)

5ns

10 GBps

CPU L3 캐시 액세스

20ns

N/A

해싱, 암호화 안전하지 않음(64바이트)

25ns

2GBps

랜덤 메모리 R/W(64바이트)

50ns

1 GBps

뮤텍스 잠금/잠금 해제

17ns

N/A

시스템 호출

500ns

N/A

해싱, 암호화 안전(64바이트)

500ns

200 MBps

순차적 SSD 읽기(8KB)

1μs

4 GBps

컨텍스트 전환

10μs

N/A

순차적 SSD 쓰기, -fsync(8KB)

10μs

1 GBps

TCP 에코 서버 (32 KiB)

10μs

4 GBps

순차적 SSD 쓰기, +fsync(8KB)

1ms

10 MBps

정렬(64비트 정수)

N/A

200 MBps

무작위 SSD 찾기 (8 KiB)

100μs

70 MBps

압축

N/A

100 MBps

압축 해제

N/A

200 MBps

프록시 Envoy/ProxySQL/NGINX/HAProxy ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

핸즈온 머신러닝(3판)

핸즈온 머신러닝(3판)

오렐리앙 제롱(Aurélien Géron)
러닝 랭체인

러닝 랭체인

메이오 오신, 누노 캄포스
Go의 동시성

Go의 동시성

Katherine Cox-Buday

Publisher Resources

ISBN: 9798341654686