Skip to content

Instantly share code, notes, and snippets.

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
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

@kik
kik / gist:2782177
Created May 24, 2012 15:19
cipher0x
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
@y-yu
y-yu / kana-rule.conf
Created May 15, 2012 06:43
kana-rule
a,あ,ア,ア
bb,っ,ッ,ッ,b
ba,ば,バ,バ
bi,び,ビ,ビ
bu,ぶ,ブ,ブ
be,べ,ベ,ベ
bo,ぼ,ボ,ボ
# DvorakJP
# コンビネーションキー
# -*- coding: utf-8 -*-
import datetime
from threading import Thread
from Queue import Queue as queue
import SocketServer
import logging
import logging.handlers
class UTC(datetime.tzinfo):
@yohhoy
yohhoy / threads.h
Last active February 15, 2025 21:51
C11 <threads.h> emulation library
/*
* C11 <threads.h> emulation library
*
* (C) Copyright yohhoy 2012.
* Distributed under the Boost Software License, Version 1.0.
* (See copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef EMULATED_THREADS_H_INCLUDED_
#define EMULATED_THREADS_H_INCLUDED_
@fjnl
fjnl / nvcc.jam
Created February 5, 2012 17:30
add -code and -arch support to nvcc.jam.
# nvcc.jam Boost.Build Jam file for extended toolset.
# Copyright (c) 2010 - 2011 Kohei Takahashi (Flast).
# Distributed under the MIT license. for more detail see COPYING.
import "class" : new ;
import common ;
import feature : feature ;
import generators ;
import modules ;
#include <iostream>
#include <thread>
#include <future>
#include <chrono>
#include <functional>
#include <deque>
struct task_queue {
task_queue() = default;
task_queue(const task_queue &) = delete;
anonymous
anonymous / stack_impl3.c
Created September 4, 2011 07:29
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <stdio.h>
#include <setjmp.h>
sigjmp_buf return_point;
/* 適切で無いハンドラ */
anonymous
anonymous / stack_impl2.c
Created September 4, 2011 07:28
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
struct Stack {
uint32_t used;
int *array;
};
anonymous
anonymous / stack_impl1.c
Created September 4, 2011 07:27
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
struct Stack {
uint32_t used;
int *array;
};