Skip to content

Instantly share code, notes, and snippets.

View chinaestone's full-sized avatar
🎯
Focusing

Estone chinaestone

🎯
Focusing
View GitHub Profile
@chinaestone
chinaestone / README.md
Last active August 29, 2015 14:14 — forked from Jxck/README.md

first, we should thanks Jxck write this libuv example . but there's some mistake in the example . In order to let the newbies learn libuv better and easy , I fixed these bugs . this example is based on libuv version 0.1.xx . and I use libuv version 0.1.19 to fixed these bugs .

the main mistake is the callback result , all the error code where lower than zero . not only -1. so I fixed these bugs . and I translate the commit to english .

how to compile

@chinaestone
chinaestone / README.md
Last active August 29, 2015 14:17 — forked from Jxck/README.md

how to compile

$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices server.c -o server
$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices client.c -o client
@chinaestone
chinaestone / restful.go
Created September 29, 2017 08:11 — forked from shaunlee/restful.go
Simple RESTful web dispatcher
package main
import (
"fmt"
"log"
"net/http"
"regexp"
"strings"
)
@chinaestone
chinaestone / latency.txt
Created December 10, 2018 02:25 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
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
@chinaestone
chinaestone / latency.markdown
Created December 10, 2018 02:31 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs