Skip to content

Instantly share code, notes, and snippets.

Hiroaki Nakamura hnakamur

Block or report user

Report or block hnakamur

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hnakamur
hnakamur / processes.erl
Created Aug 28, 2012
1M process creation in Erlang
View processes.erl
module(processes).
-export([max/1]).
%% max(N)
%% create N processes then destroy them
%% See how much time this takes
max(N) ->
Max = erlang:system_info(process_limit),
@hnakamur
hnakamur / coroutine_time.lua
Created Aug 28, 2012
1M coroutine creation in luvit
View coroutine_time.lua
local coroutine = require('coroutine')
local uv = require('uv_native')
local n = tonumber(process.argv[1])
print("n=" .. n)
local c = {}
local startTime = uv.hrtime()
for i = 1, n do
c[i] = coroutine.create(function()
print("hi")
@hnakamur
hnakamur / build.log
Created Aug 29, 2012
lev build fails with the Makefile build system
View build.log
mkdir -p build
cc -DUSE_OPENSSL -DL_ENDIAN -DOPENSSL_THREADS -DPURIFY -D_REENTRANT -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DOPENSSL_NO_RC2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD4 -DOPENSSL_NO_HW -DOPENSSL_NO_GOST -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_CMS -DOPENSSL_NO_FIPS -DOPENSSL_NO_IDEA -DOPENSSL_NO_MDC2 -DOPENSSL_NO_MD2 -DOPENSSL_NO_SEED -DOPENSSL_NO_SOCK -Ideps/openssl/openssl-configs/x64 -Wall -w --std=c89 -D_GNU_SOURCE -g -Wall -Werror -c src/luv_buffer.c -o build/luv_buffer.o \
-Ideps/http-parser -Ideps/uv/include -Ideps/luajit/src -Ideps/yajl/src/api \
-Ideps/yajl/src -Ideps/zlib -Ideps/luacrypto/src \
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
-DUSE_SYSTEM_SSL=1 \
-DHTTP_VERSION=\"v1.0-79-g8bec3ea\" \
-DUV_VERSION=\"17\" \
-DYAJL_VERSIONISH=\"2.0.4-1-g8b48967\" \
-DLUVIT_VERSION=\"\" \
@hnakamur
hnakamur / gist:3554036
Created Aug 31, 2012
pthread_create not found on Scientific Linux 6.3
View gist:3554036
[hnakamur@naruh lev]$ cmake -DUSE_SYSTEM_LUAJIT=0 -DUSE_SYSTEM_OPENSSL=0 -D USE_SYSTEM_UV=0 -DUSE_SYSTEM_YAJL=0 -DUSE_SYSTEM_ZLIB=0 -DUSE_YAJL=1 -DUSE_ZLIB=1 -DUSE_OPENSSL=1 -DUSE_HTTP_PARSER=0 ~/xming/lev
-- The C compiler identification is GNU 4.4.6
-- The CXX compiler identification is GNU 4.4.6
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
@hnakamur
hnakamur / gist:3554340
Created Aug 31, 2012
make failed on OS X Mountain Lion
View gist:3554340
sunshine5:lev hnakamur$ make
[ 1%] Performing build step for 'LUAJIT'
[ 7%] Built target buildvm
[ 8%] Generating lj_recdef.h
Error: pointer size mismatch in cross-build.
Try: make HOST_CC="gcc -m32" CROSS=... TARGET=...
make[5]: *** [lj_recdef.h] Error 1
make[4]: *** [CMakeFiles/luajit-lib.dir/all] Error 2
make[3]: *** [all] Error 2
@hnakamur
hnakamur / gist:3554369
Created Aug 31, 2012
make failed on Scientific Linux 6.3
View gist:3554369
[hnakamur@naruh lev]$ LANG=C make
[ 9%] Built target LUAJIT
[ 18%] Built target OPENSSL
[ 26%] Built target LUACRYPTO
[ 35%] Built target UV
[ 43%] Built target YAJL
[ 51%] Built target ZLIB
[ 52%] Building C object CMakeFiles/lev-lib.dir/src/modules/yajl/src/lyajl.c.o
/home/hnakamur/xming/lev/src/modules/yajl/src/lyajl.c:25:29: error: yajl/yajl_parse.h: No such file or directory
/home/hnakamur/xming/lev/src/modules/yajl/src/lyajl.c:26:27: error: yajl/yajl_gen.h: No such file or directory
@hnakamur
hnakamur / gist:3555057
Created Aug 31, 2012
VERBOSE=1 make on Scientific Linux 6.3
View gist:3555057
$ LANG=C VERBOSE=1 make
/usr/local/bin/cmake -H/home/hnakamur/xming/lev -B/tmp/lev --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/bin/cmake -E cmake_progress_start /tmp/lev/CMakeFiles /tmp/lev/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/tmp/lev'
make -f CMakeFiles/LUAJIT.dir/build.make CMakeFiles/LUAJIT.dir/depend
make[2]: Entering directory `/tmp/lev'
cd /tmp/lev && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /home/hnakamur/xming/lev /home/hnakamur/xming/lev /tmp/lev /tmp/lev /tmp/lev/CMakeFiles/LUAJIT.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/tmp/lev'
make -f CMakeFiles/LUAJIT.dir/build.make CMakeFiles/LUAJIT.dir/build
@hnakamur
hnakamur / gist:3555160
Created Aug 31, 2012
yajl/yajl_parse.h not found
View gist:3555160
[ 52%] Building C object CMakeFiles/lev-lib.dir/src/modules/yajl/src/lyajl.c.o
/usr/bin/gcc -DLUVIT_VERSION=\"0.4\" -DLUAJIT_VERSION=\"v2.0.0-beta10\" -DUV_VERSION=\"3\" -DUSE_OPENSSL -DYAJL_VERSIONISH=\"2.0.5\" -DUSE_YAJL -DUSE_ZLIB -DUSE_LUACRYPTO -I/home/hnakamur/xming/lev/src/core/src -I/tmp/lev/LUAJIT-prefix/src/LUAJIT/src -I/tmp/lev/UV-prefix/src/UV/include -I/tmp/lev/OPENSSL-prefix/src/OPENSSL/include/openssl -I/home/hnakamur/xming/lev/src/modules/openssl/src -I/tmp/lev/YAJL-prefix/src/YAJL/src/api -I/home/hnakamur/xming/lev/src/modules/yajl/src -I/tmp/lev/ZLIB-prefix/src/ZLIB/. -I/home/hnakamur/xming/lev/src/modules/zlib/src -I/tmp/lev/LUACRYPTO-prefix/src/LUACRYPTO/src -I/home/hnakamur/xming/lev/src/modules/luacrypto/src -o CMakeFiles/lev-lib.dir/src/modules/yajl/src/lyajl.c.o -c /home/hnakamur/xming/lev/src/modules/yajl/src/lyajl.c
/home/hnakamur/xming/lev/src/modules/yajl/src/lyajl.c:25:29: error: yajl/yajl_parse.h: No such file or directory
/home/hnakamur/xming/lev/src/modules/yajl/src/lyajl
@hnakamur
hnakamur / gist:3555161
Created Aug 31, 2012
yajl/yajl_parse.h not found
View gist:3555161
[ 52%] Building C object CMakeFiles/lev-lib.dir/src/modules/yajl/src/lyajl.c.o
/usr/bin/gcc -DLUVIT_VERSION=\"0.4\" -DLUAJIT_VERSION=\"v2.0.0-beta10\" -DUV_VERSION=\"3\" -DUSE_OPENSSL -DYAJL_VERSIONISH=\"2.0.5\" -DUSE_YAJL -DUSE_ZLIB -DUSE_LUACRYPTO -I/home/hnakamur/xming/lev/src/core/src -I/tmp/lev/LUAJIT-prefix/src/LUAJIT/src -I/tmp/lev/UV-prefix/src/UV/include -I/tmp/lev/OPENSSL-prefix/src/OPENSSL/include/openssl -I/home/hnakamur/xming/lev/src/modules/openssl/src -I/tmp/lev/YAJL-prefix/src/YAJL/src/api -I/home/hnakamur/xming/lev/src/modules/yajl/src -I/tmp/lev/ZLIB-prefix/src/ZLIB/. -I/home/hnakamur/xming/lev/src/modules/zlib/src -I/tmp/lev/LUACRYPTO-prefix/src/LUACRYPTO/src -I/home/hnakamur/xming/lev/src/modules/luacrypto/src -o CMakeFiles/lev-lib.dir/src/modules/yajl/src/lyajl.c.o -c /home/hnakamur/xming/lev/src/modules/yajl/src/lyajl.c
/home/hnakamur/xming/lev/src/modules/yajl/src/lyajl.c:25:29: error: yajl/yajl_parse.h: No such file or directory
/home/hnakamur/xming/lev/src/modules/yajl/src/lyajl
@hnakamur
hnakamur / gist:3556499
Created Aug 31, 2012
tests fail with lev built with cmake on scientific linux
View gist:3556499
$ cd ~/xming/lev/tests
$ /tmp/lev/lev runner.lua
...(snip)...
FAIL (test-http-post-1mb.lua)
WARNING: forgot to close luv_pipe lhandle=0x41674ce0 handle=0xb21490
FAIL (test-dgram.lua)
You can’t perform that action at this time.