Skip to content

Instantly share code, notes, and snippets.

View joelklabo's full-sized avatar
Zapping

klabo joelklabo

Zapping
View GitHub Profile
@joelklabo
joelklabo / latency.txt
Created September 14, 2012 03:38 — forked from nahurst/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers Time Light Distance Approximate Light Distance
-------------------------- ---- -------------- --------------------------
L1 cache reference 0.5 ns 0.15 m Diagonal across your smartphone
Branch mispredict 5 ns 1.5 m Height of Natalie Portman
L2 cache reference 7 ns 2.1 m Height of Shaq
Mutex lock/unlock 25 ns 7.5 m Height of a school flag pole
Main memory reference 100 ns 30 m Half a Manhattan city block (North/South)
Compress 1K bytes with Zippy 3,000 ns 900 m Width of Central Park
Send 1K bytes over 1 Gbps network 10,000 ns 3,000 m Width of Manhattan
Read 4K randomly from SSD* 150,000 ns 45,000 m NYC to Hempstead on Long Island
" Completion menu: completes based on text of current file, as well as other
" open buffers/windows. Use <Tab> to open the menu (or pick another key, see
" the last line), as well as to cycle between the different options. Use
" <Enter> or <Space> to use use option.
set complete=.,w,b
set completeopt=longest,menu,menuone,preview
function! AutoCompleteOnKey(key)
if pumvisible() " menu open, loop through choices
return "\<Down>"
else " menu not open, open conditionally