Skip to content

Instantly share code, notes, and snippets.

@Jxck
Jxck / benchmark.md
Last active August 29, 2015 13:56
benchmark of Generator in Go using Channel & Closure

on Mac Book Air (OSX 10.7.5) 1.6 GHz Intel Core i5 Memory 4GB

$ go test -bench .
PASS
BenchmarkClosure        100000000    11.5 ns/op
BenchmarkMutexClosure   50000000     35.3 ns/op
BenchmarkAtomicClosure 100000000 17.8 ns/op
@Jxck
Jxck / map.go
Created February 9, 2014 09:53
Not Atomic operation on Map
package main
import (
"log"
"runtime"
"sync"
)
var debug func(a ...interface{})
@Jxck
Jxck / a.txt
Last active November 11, 2019 23:18
ジェネレータの解説と非同期への適用 完成品 http://jxck.hatenablog.com/entry/2014-01-12/generator-screencaset
b.txt
@Jxck
Jxck / generator.js
Created January 11, 2014 10:49
next() の挙動がよくわからない。
function* generator() {
console.log(yield 1);
console.log(yield 2);
console.log(yield 3);
return 4;
}
var g = generator();
console.log(g.next(0)); // この 0 を取る方法は?
console.log(g.next(10));
@Jxck
Jxck / tfo-client.py
Created December 8, 2013 09:09
TCP Fast Open – Webを速くするためにGoogleがやっていること Make the Web Faster 4 - Python サンプルコード
import sys, socket
'''
tcp fast open server sample code
execute it before enable tfo flag
$ echo 3 | sudo tee /proc/sys/net/ipv4/tcp_fastopen
'''
PORT = 80
MSG_FASTOPEN = 0x20000000
@Jxck
Jxck / testcase.1.txt
Last active December 22, 2015 12:49
HPAC の Encoding 戦略の考察
全て Without Indexing で送るパターン
HT を更新しない。
結果的には :scheme, :method くらいしか使いまわさないパターン。
[1]
HeaderSet
:scheme: https
:host: jxck.io
@Jxck
Jxck / .gitignore
Last active December 18, 2015 19:09
blog sample advanced go concurrency pattern
.DS_Store
@Jxck
Jxck / main.go
Last active August 31, 2017 10:27
interface of Go blog sample
package main
/*
Go のインタフェース設計
参考
https://code.google.com/p/go-wiki/wiki/GoForCPPProgrammers
http://jordanorelli.tumblr.com/post/32665860244/how-to-use-interfaces-in-go
http://research.swtch.com/interfaces
http://www.airs.com/blog/archives/277
@Jxck
Jxck / .gitignore
Created January 24, 2013 16:32
Socket.IO sample for Node.js_jp ML
node_modules