Skip to content

Instantly share code, notes, and snippets.

View cfsghost's full-sized avatar

Fred Chien(錢逢祥) cfsghost

View GitHub Profile
@cfsghost
cfsghost / robot.js
Created December 5, 2012 02:08
Frextank
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
var self = this;
self.robot = robot;
self.members = {};
robot.clone();
@cfsghost
cfsghost / buffer-1024
Last active August 29, 2015 14:15
io.js with slab memory allocator (node_http_parser only)
This is ApacheBench, Version 2.3 <$Revision: 1554214 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Server Software:
Server Hostname: 127.0.0.1
Server Port: 8000
@cfsghost
cfsghost / buffer-1024
Last active August 29, 2015 14:15
io.js v1.x
This is ApacheBench, Version 2.3 <$Revision: 1554214 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Server Software:
Server Hostname: 127.0.0.1
Server Port: 8000
@cfsghost
cfsghost / ab-hello-world-buffer-1024
Created February 11, 2015 09:33
using slab memory allocator to replace all allocators
This is ApacheBench, Version 2.3 <$Revision: 1554214 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Server Software:
Server Hostname: 127.0.0.1
Server Port: 8000
@cfsghost
cfsghost / buffer-1024
Created February 11, 2015 17:00
iojs (replace all allocators with slab implementation)
This is ApacheBench, Version 2.3 <$Revision: 1554214 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Server Software:
Server Hostname: 127.0.0.1
Server Port: 8000
@cfsghost
cfsghost / gist:98c6bf1e05a695d69b18
Created February 14, 2015 12:40
v1.x vs slab allocation
http/client-request-body.js v1.x v.1.x-slab-experiment
dur=5 type=asc bytes=32 method=write 7160.07564 7506.41816
dur=5 type=asc bytes=32 method=end 7157.35209 7221.59182
dur=5 type=asc bytes=256 method=write 6951.54187 7027.47337
dur=5 type=asc bytes=256 method=end 7124.46118 7509.53170
dur=5 type=asc bytes=1024 method=write 6743.92064 7100.50591
dur=5 type=asc bytes=1024 method=end 6924.91636 6777.61740
dur=5 type=utf bytes=32 method=write 7080.62645 7360.18988
dur=5 type=utf bytes=32 method=end 7247.72584 7372.85813
var fs = require('fs');
var qr = require('qr-image');
var co = require('co');
co(function *() {
for (var index = 1; index <= 100; index++) {
yield function() {
return function(done) {
@cfsghost
cfsghost / light-sensor.ino
Created October 13, 2016 14:41
light-sensor.ino
/*
* 此範例
* A2接Light Sensor v1.1
* D4接Buzzer v1.2
* analogPin=撈取A2 Sensor值
* 計算方式 5v/1024每個刻度4.9mv左右
* 實際量測過這顆sensor 輸出最高數值約為2.08v左右
* 依照這個基準點算起來2.08v/4.9mv所以就會得到425左右的值輸入
* 此範例程式將撈取到的值供Delay使用
* 所以當沒有光線的時候Delay越少
@cfsghost
cfsghost / middleware
Last active March 14, 2017 11:20
Benchmark for Node.js web frameworks
$ make test -f Makefile2
> [email protected] postinstall /Users/fred/projects/koa-benchmark/koa2
> babel koa2-async.js --out-file koa2-async-compile.js
prepare complete
benchmark koa-1
1 middleware
6295.24
@cfsghost
cfsghost / Installation.sh
Last active September 26, 2017 22:18
Groa.js : Koa-like gRPC Middleware Framework Installation
npm install groa --save