모든 언어별 공통적인 최적화 개념

link



Temporal locality in memory mountain|🔝|


모든 프로그래머들이 알아야 할 컴퓨터의 시간 정리|🔝|

Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference                           0.5 ns
Branch mispredict                            5   ns
L2 cache reference                           7   ns                      14x L1 cache
Mutex lock/unlock                           25   ns
Main memory reference                      100   ns                      20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy             3,000   ns        3 us
Send 1K bytes over 1 Gbps network       10,000   ns       10 us
Read 4K randomly from SSD*             150,000   ns      150 us          ~1GB/sec SSD
Read 1 MB sequentially from memory     250,000   ns      250 us
Round trip within same datacenter      500,000   ns      500 us
Read 1 MB sequentially from SSD*     1,000,000   ns    1,000 us    1 ms  ~1GB/sec SSD, 4X memory
Disk seek                           10,000,000   ns   10,000 us   10 ms  20x datacenter roundtrip
Read 1 MB sequentially from disk    20,000,000   ns   20,000 us   20 ms  80x memory, 20X SSD
Send packet CA->Netherlands->CA    150,000,000   ns  150,000 us  150 ms

Notes
-----
1 ns = 10^-9 seconds
1 us = 10^-6 seconds = 1,000 ns
1 ms = 10^-3 seconds = 1,000 us = 1,000,000 ns

Credit
------
By Jeff Dean:               http://research.google.com/people/jeff/
Originally by Peter Norvig: http://norvig.com/21-days.html#answers

Contributions
-------------
'Humanized' comparison:  https://gist.github.com/hellerbarde/2843375
Visual comparison chart: http://i.imgur.com/k0t1e.png

프로그래머가 알아야 할 지연 시간 숫자를 시각적으로 표현[🔝]

GN⁺: 모든 프로그래머가 알아야 할 필수 숫자들

  • https://samwho.dev/numbers/?fo
  • L1 캐시 참조: 1나노초
  • 분기 예측 실패: 3나노초
  • L2 캐시 참조: 4나노초
  • 뮤텍스 잠금/해제: 17나노초
  • 1 Gbps 네트워크를 통한 1KB 데이터 전송: 44나노초
  • 주 메모리 참조: 100나노초
  • Zippy를 이용한 1KB 데이터 압축: 2마이크로초
  • 메모리에서 1MB 순차 읽기: 3마이크로초
  • SSD에서 4K 무작위 읽기: 16마이크로초
  • SSD에서 1MB 순차 읽기: 49마이크로초
  • 동일 데이터센터 내 왕복 시간: 500마이크로초
  • 디스크에서 1MB 순차 읽기: 825마이크로초
  • 디스크 탐색: 2밀리초
  • 캘리포니아에서 네덜란드까지 패킷 전송 후 돌아오기: 150밀리초
Operationnsµsmsnote
L1 cache reference0.5 ns
Branch mispredict5 ns
L2 cache reference7 ns14x L1 cache
Mutex lock/unlock25 ns
Main memory reference100 ns20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy3,000 ns3 µs
Send 1K bytes over 1 Gbps network10,000 ns10 µs
Read 4K randomly from SSD*150,000 ns150 µs~1GB/sec SSD
Read 1 MB sequentially from memory250,000 ns250 µs
Round trip within same datacenter500,000 ns500 µs
Read 1 MB sequentially from SSD*1,000,000 ns1,000 µs1 ms~1GB/sec SSD, 4X memory
Disk seek10,000,000 ns10,000 µs10 ms20x datacenter roundtrip
Read 1 MB sequentially from disk20,000,000 ns20,000 µs20 ms80x memory, 20X SSD
Send packet CA -> Netherlands -> CA150,000,000 ns150,000 µs150 ms

지그 창시자가 설명해 주는 Operation Cost in CPU Cycles & Andrew Kelley Practical Data Oriented Design (DoD)[🔝]

Screenshot 2024-07-19 at 9 24 35 PM

  • Andrew Kelley Practical Data Oriented Design (DoD) | ChimiChanga(5min50sec)
    • https://youtu.be/IroPQ150F6c?si=tOxqzFtk5hkuWwYt

시대별로 단위가 생긴거 표로 잘 정리됨(Mertic_prefix_pico_kilo_nano..etc.[🔝]

Prefix Base 10 Decimal Adoption
[nb 1]
Name Symbol
quetta Q 1030 1000000000000000000000000000000 2022[3]
ronna R 1027 1000000000000000000000000000
yotta Y 1024 1000000000000000000000000 1991
zetta Z 1021 1000000000000000000000
exa E 1018 1000000000000000000 1975[4]
peta P 1015 1000000000000000
tera T 1012 1000000000000 1960
giga G 109 1000000000
mega M 106 1000000 1873
kilo k 103 1000 1795
hecto h 102 100
deca da 101 10
100 1
deci d 10−1 0.1 1795
centi c 10−2 0.01
milli m 10−3 0.001
micro μ 10−6 0.000001 1873
nano n 10−9 0.000000001 1960
pico p 10−12 0.000000000001
femto f 10−15 0.000000000000001 1964
atto a 10−18 0.000000000000000001
zepto z 10−21 0.000000000000000000001 1991
yocto y 10−24 0.000000000000000000000001
ronto r 10−27 0.000000000000000000000000001 2022[3]
quecto q 10−30 0.000000000000000000000000000001
Notes
  1. ^ Prefixes adopted before 1960 already existed before SI. The introduction of the CGS system was in 1873.

SI 접두어
v d e h
10n 접두어 기호 배수 십진수
1030 퀘타 (quetta) Q 1 000 000 000 000 000 000 000 000 000 000
1027 론나 (ronna) R 1 000 000 000 000 000 000 000 000 000
1024 요타 (yotta) Y 1 000 000 000 000 000 000 000 000
1021 제타 (zetta) Z 1 000 000 000 000 000 000 000
1018 엑사 (exa) E 1 000 000 000 000 000 000
1015 페타 (peta) P 1 000 000 000 000 000
1012 테라 (tera) T 1 000 000 000 000
109 기가 (giga) G 십억 1 000 000 000
106 메가 (mega) M 백만 1 000 000
103 킬로 (kilo) k 1 000
102 헥토 (hecto) h 100
101 데카 (deca) da 10
100 1
10−1 데시 (deci) d 십분의 일 0.1
10−2 센티 (centi) c 백분의 일 0.01
10−3 밀리 (milli) m 천분의 일 0.001
10−6 마이크로 (micro) µ 백만분의 일 0.000 001
10−9 나노 (nano) n 십억분의 일 0.000 000 001
10−12 피코 (pico) p 일조분의 일 0.000 000 000 001
10−15 펨토 (femto) f 천조분의 일 0.000 000 000 000 001
10−18 아토 (atto) a 백경분의 일 0.000 000 000 000 000 001
10−21 젭토 (zepto) z 십해분의 일 0.000 000 000 000 000 000 001
10−24 욕토 (yocto) y 일자분의 일 0.000 000 000 000 000 000 000 001
10−27 론토 (ronto) r 천자분의 일 0.000 000 000 000 000 000 000 000 001
10−30 퀙토 (quecto) q 백양분의 일 0.000 000 000 000 000 000 000 000 000 001

트위터 추천 알고리즘(scala로 작성됨)[🔝]


애니매이션으로 모든 물리학 공식과 같이 연관 되어 보기.. 진짜 대박 최고 !!❤[🔝]




그림으로 이해하는 Switch, if else, while, foreach, try, catch|🔝|

물어보고 싶거나 하고 싶은말 써 주세요comment|🔝|