Skip to content

Instantly share code, notes, and snippets.

View fuxingloh's full-sized avatar
🦆
quack quack

Fuxing Loh fuxingloh

🦆
quack quack
View GitHub Profile
@BlackHC
BlackHC / nesk.txt
Last active March 25, 2026 09:18
Numbers everyone (programmer) should know (2023)
Latency Comparison Numbers (~2023)
----------------------------------
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 Snappy 3,000 ns 3 µs
Read 1 MB sequentially from memory 20,000 ns 20 µs ~50GB/sec DDR5
Read 1 MB sequentially from NVMe 100,000 ns 100 µs ~10GB/sec NVMe, 5x memory
@karpathy
karpathy / microgpt.py
Last active August 12, 2026 18:12
microgpt
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp