This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'win32ole' | |
require 'delegate' | |
require 'singleton' | |
class TheExcel<SimpleDelegator | |
include Singleton | |
def initialize | |
@excel = WIN32OLE.new("Excel.Application") | |
@excel['Visible'] = TRUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rbconfig' | |
require 'pp' | |
class Lex | |
def initialize(str) | |
@tokens = str.scan(/#.*?\n|\/\*.*?\*\/|[a-zA-Z_][a-zA-Z_0-9]*|-?[0-9]+\.?[0-9]*|\S/m).each | |
@udtype_table = {} | |
end | |
def set_user_type_table(tab) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pattern matcher | |
# Usage | |
# When pattern matched, block is yielded with argument is hash that maps | |
# symbol to value. | |
# | |
# mat = Matcher.new | |
# mat.pattern([:a, :b]) {|hash| | |
# p hash | |
# } | |
# mat.match([1, 2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Matcher | |
def initialize | |
@cache = {} | |
@code = nil | |
@pattern = [] | |
end | |
def match(src) | |
unless @code | |
compile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Elapesed time: 3267.578364636 (sec) | |
----------------------------------------------------------- | |
benchmark results: | |
name ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux] ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux] | |
name orig jemalloc | |
app_answer 0.551 0.863 | |
app_erb 4.909 4.897 | |
app_factorial 1.642 3.776 | |
app_fib 4.846 4.827 | |
app_mandelbrot 2.760 3.038 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Elapesed time: 3105.806184843 (sec) | |
----------------------------------------------------------- | |
benchmark results: | |
name ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux] ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux] | |
app_answer 0.862 2.191 | |
app_erb 7.567 5.904 | |
app_factorial 1.965 5.285 | |
app_fib 7.093 5.030 | |
app_mandelbrot 2.812 2.963 | |
app_pentomino 153.422 150.046 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Unused Variable Checker | |
# | |
# Usage: ruby varcheck.rb test-src.rb | |
# | |
# | |
module VarCheck | |
class InstSeqTree | |
Headers = %w(magic major_version minor_version format_type | |
misc name filename filepath line type locals args | |
exception_table) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YTL::define_macro :foo do |x| | |
if x == 0 then | |
x | |
else | |
1 | |
end | |
end | |
このmacroの本体が次のようなRubyプログラムに変換されます、。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
benchmark Ruby 1.9.3dev(2010-11-29 trunk 29968), ytl 0.0.3 (ytljit 0.0.7) | |
bm_so_binary_trees.rb | |
time ytl bm_so_binary_trees.rb | |
real 1m9.088s | |
user 1m8.406s | |
sys 0m0.592s | |
time ytl --compile-array-as-unboxed bm_so_binary_trees.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
benchmark Ruby 1.9.3dev(2010-11-29 trunk 29968), ytl 0.0.3 (ytljit 0.0.7) | |
bm_so_binary_trees.rb | |
time ytl bm_so_binary_trees.rb | |
real 1m9.905s | |
user 1m9.046s | |
sys 0m0.639s | |
time ytl --compile-array-as-unboxed bm_so_binary_trees.rb |
OlderNewer