簡単なレジスタベースVMを作り、fib(38)
を実行した時のマイクロベンチ結果
アドレスのアラインメントを利用した埋め込みを実装した処理系
オブジェクトは環境非依存で64bit固定
ポインタをmodifyする必要がある
def date_to_a(t) | |
[ | |
"#{t.year}年", | |
"#{t.month}月", | |
"#{t.day}日", | |
" #{t.hour}時#{t.min}分", | |
] | |
end | |
def date_conv(t1, t2) |
# From the tty_ioctl man page in Linux. | |
# | |
# TIOCGWINSZ struct winsize *argp | |
# Get window size. | |
# | |
# TIOCSWINSZ const struct winsize *argp | |
# Set window size. | |
# | |
# The struct used by these ioctls is defined as | |
# |
fizzer = [nil, nil, "Fizz"].cycle | |
buzzer = [nil, nil, nil, nil, "Buzz"].cycle | |
puts (1..Float::INFINITY).lazy.zip(fizzer, buzzer) | |
.map{|i, fizz, buzz| | |
fizz || buzz ? "#{fizz}#{buzz}" : i | |
} | |
.first(20) |