Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Yutaka Matsubara mopemope

🏠
Working from home
View GitHub Profile
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 — forked from jboner/latency.txt
Latency numbers every programmer should know
View latency.markdown

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
@HarryR
HarryR / redis-parser.rl
Created Jan 2, 2012
Redis server-side protocol parser for Ragel
View redis-parser.rl
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
%%{
machine redis_parser;
action reset_line {
View gist:547651
Index: ../Python/pythonrun.c
===================================================================
--- ../Python/pythonrun.c (revision 82245)
+++ ../Python/pythonrun.c (working copy)
@@ -1334,6 +1334,7 @@
return ret;
}
+bool toplevel = true;
static PyObject *
View Coro.ooc
Coro: class {
// this was originally commented '128k needed on PPC due to parser'
// I have no idea what that means but 128k sounds reasonable.
DEFAULT_STACK_SIZE := static 128 * 1_024
MIN_STACK_SIZE := static 8_192
requestedStackSize: SizeT { get set }
allocatedStackSize: SizeT
@somic
somic / udp_hole_punch_tester.py
Created Nov 3, 2009
UDP Hole Punching test tool
View udp_hole_punch_tester.py
#!/usr/bin/env python
#
# udp_hole_punch_tester.py - UDP Hole Punching test tool
#
# Usage: udp_hole_punch_tester.py remote_host remote_port
#
# Run this script simultaneously on 2 hosts to test if they can punch
# a UDP hole to each other.
#
# * remote_port should be identical on 2 hosts.
You can’t perform that action at this time.