Skip to content

Instantly share code, notes, and snippets.

View methane's full-sized avatar

Inada Naoki methane

  • KLab Inc,
  • Japan
  • 18:44 (UTC +09:00)
  • X @methane
View GitHub Profile
@methane
methane / README.md
Last active March 17, 2016 08:42
Quick benchmark on PyMySQL
time[sec]
CPython 3.4.2(6f78fcb) 20.5
CPython 3.4.2(a724607) 14.2
PyPy 2.5 (6f78fcb) 3.4
PyPy 2.5 (a724607) 3.1
CPython (mysqlclient) 2.8

Dataset is "world database (innodb)". It is deployed on here

@methane
methane / codec.go
Created January 29, 2015 07:30
Can't encode RawExt
package main
import (
"fmt"
"github.com/ugorji/go/codec"
)
var mh = codec.MsgpackHandle{}
package main
import (
"fmt"
"github.com/ugorji/go/codec"
)
var mh = codec.MsgpackHandle{}
@methane
methane / 0.README.md
Last active September 27, 2020 05:48
http-parser vs picohttpparser
@methane
methane / README.md
Last active August 29, 2015 14:11
Gazelle vs Meinheld

環境:

  • c3.8xlarge (32core)
  • Amazon Linux
  • Perl は yum install perl-devel したもの
  • Python は pyenv を利用して 2.7.9 をビルド
  • nginx は OpenResty (echo のため)

ボトルネックが変化してもなるべくベンチマークのオプションを変えずにCPUを使うため、 wrk, nginx, Webアプリそれぞれ16プロセス(orスレッド) を利用する。 ただし、 meinheld, minefield については、 16 プロセスだと thundering herd 問題を起こしているらしく性能が激しく劣化するので、 worker=8 にする。

@methane
methane / regex-dna1.go
Created December 8, 2014 02:07
regex-dna.go
// 初期実装
/* The Computer Language Benchmarks Game
* http://benchmarksgame.alioth.debian.org/
*
* contributed by The Go Authors.
* modified by Tylor Arndt.
* modified by Chandra Sekar S to use optimized PCRE binding.
*/
package main
@methane
methane / hello.c
Last active June 25, 2017 16:58
Hello, World! from h2o
/*
* Copyright (c) 2014 DeNA Co., Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@methane
methane / Go 1.3.3
Last active August 29, 2015 14:10
Hello bench on c3.xlarge
[ec2-user@ip-10-0-1-177 wrk]$ ./wrk -t1 -c1 -d3s http://10.0.1.150:8000/
Running 3s test @ http://10.0.1.150:8000/
1 threads and 1 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 135.24us 9.92us 453.00us 91.03%
Req/Sec 7.51k 426.94 8.11k 61.60%
21401 requests in 3.00s, 2.37MB read
Requests/sec: 7133.98
Transfer/sec: 808.15KB
[ec2-user@ip-10-0-1-177 wrk]$ ./wrk -t4 -c100 -d10s http://10.0.1.150:8000/
$ python -c "import sys; print(sys.stdout.encoding)"
UTF-8
$ python -c "import sys; print(sys.stdout.encoding)" | cat
None
$ PYTHONIOENCODING=utf-8 python -c "import sys; print(sys.stdout.encoding)" | cat
utf-8
$ python3 -c "import sys; print(sys.stdout.encoding)"
UTF-8
$ python3 -c "import sys; print(sys.stdout.encoding)" | cat
UTF-8
ROUTINE ====================== net/http.ReadRequest
11 403 samples (flat, cumulative) 27.2% of total
-------------------- /home/ec2-user/local/go/src/net/http/request.go
2 2 591: func ReadRequest(b *bufio.Reader) (req *Request, err error) {
. . 447b70: FS MOVQ FS:0xfffffff0, CX
2 2 447b79: LEAQ 0xffffff30(SP), AX
. . 447b81: CMPQ 0x10(CX), AX
. . 447b85: JA 0x447b8e
. . 447b87: CALL runtime.morestack_noctxt(SB)
. . 447b8c: JMP net/http.ReadRequest(SB)