Skip to content

Instantly share code, notes, and snippets.

View pfmiles's full-sized avatar
🚀
Busy...may not respond.

pf_miles pfmiles

🚀
Busy...may not respond.
View GitHub Profile
@pfmiles
pfmiles / IOUtil.java
Last active September 23, 2016 10:22 — forked from awilmore/IOUtil.java
IO channel间互相“流”数据的方案,尽可能zero-cory
package com.awilmore.ioutils;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SeekableByteChannel;
import java.nio.channels.WritableByteChannel;
public class IOUtil {
@pfmiles
pfmiles / latency.txt
Created May 31, 2012 14:36 — forked from jboner/latency.txt
Latency numbers every programmer should know with 中文常用单位注释
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微秒
Send 2K bytes over 1 Gbps network 20,000 ns // 20微秒
Read 1 MB sequentially from memory 250,000 ns // 0.25毫秒
Round trip within same datacenter 500,000 ns // 0.5毫秒
Disk seek 10,000,000 ns // 10毫秒