Skip to content

Instantly share code, notes, and snippets.

View kenix's full-sized avatar

Mike Zhao kenix

  • Infront Financial Technology AG
  • Zurich
  • X @bluepinme
View GitHub Profile
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.util.Arrays;
import java.util.Iterator;
import java.util.stream.IntStream;
@kenix
kenix / WriteCombining.java
Created December 26, 2015 21:11
Write Combining demo case according to same named blog entry on Mechanical Sympathy
import java.util.stream.IntStream;
/**
* jdk1.8.0_31
* machdep.cpu.brand_string: Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
* machdep.cpu.cache.size: 256
* machdep.cpu.core_count: 2
* machdep.cpu.thread_count: 4
* <p>
* Quote from https://software.intel.com/de-de/forums/software-tuning-performance-optimization-platform-monitoring/topic/278254"
@kenix
kenix / latency.txt
Created December 22, 2015 21:03 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
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
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms