BasicObject
AO render benchmark Original program (C) Syoyo Fujita in Javascript (and other languages)
https://code.google.com/p/aobench/
Ruby(yarv2llvm) version by Hideki Miura mruby version by Hideki Miura
# File typeprof-0.15.2/smoke/array11.rb, line 1
def array(obj)
Array(obj)
end
# File typeprof-0.15.2/smoke/masgn2.rb, line 1
def ary
[1, "str", :sym, 1.0]
end
# File typeprof-0.15.2/testbed/ao.rb, line 142
def clamp(f)
i = f * 255.5
if i > 255.0
i = 255.0
end
if i < 0.0
i = 0.0
end
i.to_i
end
# File typeprof-0.15.2/smoke/flip-flop.rb, line 1
def cond1?
rand < 0.5
end
# File typeprof-0.15.2/smoke/flip-flop.rb, line 5
def cond2?
rand < 0.5
end
# File typeprof-0.15.2/smoke/rest3.rb, line 19
def corge(*r, z)
end
# File typeprof-0.15.2/smoke/array-range-aref.rb, line 41
def dispatch(*ary)
f1(*ary)
f2(*ary)
f3(*ary)
f4(*ary)
f5(*ary)
f6(*ary)
f7(*ary)
f8(*ary)
f9(*ary)
f10(*ary)
end
# File typeprof-0.15.2/smoke/huge_union.rb, line 15
def dispatch_foo(n)
n.foo("str")
end
# File typeprof-0.15.2/smoke/array14.rb, line 1
def f(a, b, c)
ary = [nil]
foo, bar, ary[0] = a, b, c
ary[0]
end
# File typeprof-0.15.2/smoke/arguments2.rb, line 37
def f10(&blk)
blk.call(1)
end
# File typeprof-0.15.2/smoke/arguments2.rb, line 5
def f2(x, y, z)
end
# File typeprof-0.15.2/smoke/arguments2.rb, line 9
def f3(x = "str", y = "str")
end
# File typeprof-0.15.2/smoke/arguments2.rb, line 17
def f5(x, y = "str", z)
end
# File typeprof-0.15.2/smoke/arguments2.rb, line 25
def f7(k: 42)
end
# File typeprof-0.15.2/smoke/arguments2.rb, line 29
def f8(k: "str")
end
# File typeprof-0.15.2/smoke/arguments2.rb, line 33
def f9(**kw)
end
recursive method
# File typeprof-0.15.2/smoke/demo.rb, line 30
def fib(x)
if x <= 1
x
else
fib(x - 1) + fib(x - 2)
end
end
# File typeprof-0.15.2/smoke/alias.rb, line 1
def foo(x)
x
end
# File typeprof-0.15.2/smoke/enumerator.rb, line 4
def fuga
1.then
end
# File typeprof-0.15.2/smoke/struct2.rb, line 7
def gen_foobar
FooBar.new(1)
end
# File typeprof-0.15.2/smoke/rbs-interface.rb, line 9
def get_interface
C.new.get_interface
end
# File typeprof-0.15.2/smoke/rbs-interface.rb, line 13
def get_interface_foo
C.new.get_interface.foo
end
# File typeprof-0.15.2/smoke/rbs-interface.rb, line 1
def get_module
C.new.get_module
end
# File typeprof-0.15.2/smoke/rbs-interface.rb, line 5
def get_module_foo
C.new.get_module.foo
end
# File typeprof-0.15.2/smoke/rest3.rb, line 23
def grault(a, o=1, *r, z)
end
# File typeprof-0.15.2/smoke/rbs-vars.rb, line 1
def gvar_test
$gvar
end
# File typeprof-0.15.2/smoke/enumerator.rb, line 1
def hoge
[1, 2, 3].map
end
overrided method
# File typeprof-0.15.2/smoke/demo.rb, line 16
def identity(x)
x
end
# File typeprof-0.15.2/smoke/block-ambiguous.rb, line 4
def log1(x); end
# File typeprof-0.15.2/smoke/block-ambiguous.rb, line 10
def log2(x); end
# File typeprof-0.15.2/smoke/block-ambiguous.rb, line 16
def log3(x); end
# File typeprof-0.15.2/smoke/block-ambiguous.rb, line 22
def log4(x); end
# File typeprof-0.15.2/smoke/block-args1-rest.rb, line 43
def log5(a, o, c); end
# File typeprof-0.15.2/smoke/block-args3-rest.rb, line 52
def log6(a, o, r, c); end
# File typeprof-0.15.2/smoke/array-map3.rb, line 4
def map_bang_test(a)
a.map! {|n| n.to_s }
a
end
# File typeprof-0.15.2/smoke/array-map3.rb, line 8
def map_bang_test_known_bug(a)
a.map! {|n| n.to_s }
end
# File typeprof-0.15.2/smoke/array-map3.rb, line 1
def map_test(a)
a.map {|n| n.to_s }
end
override
# File typeprof-0.15.2/smoke/demo2.rb, line 2
def my_to_s(x)
x.to_s
end
# File typeprof-0.15.2/smoke/function.rb, line 1
def no_argument
"str"
end
# File typeprof-0.15.2/smoke/type_var.rb, line 1
def number?(ty)
%w[integer float].include?(ty).then { puts 1 }
end
# File typeprof-0.15.2/smoke/function.rb, line 5
def one_argument(x)
end
# File typeprof-0.15.2/testbed/ao.rb, line 153
def otherBasis(n)
zero = Vec.new(0.0, 0.0, 0.0)
basis = [zero, zero, zero]
basis[2] = Vec.new(n.x, n.y, n.z)
basis[1] = Vec.new(0.0, 0.0, 0.0)
if n.x < 0.6 and n.x > -0.6
basis[1].x = 1.0
elsif n.y < 0.6 and n.y > -0.6
basis[1].y = 1.0
elsif n.z < 0.6 and n.z > -0.6
basis[1].z = 1.0
else
basis[1].x = 1.0
end
basis[0] = basis[1].vcross(basis[2])
basis[0] = basis[0].vnormalize
basis[1] = basis[2].vcross(basis[0])
basis[1] = basis[1].vnormalize
basis
end
# File typeprof-0.15.2/smoke/identifier_keywords.rb, line 4
def out(*out)
end
# File typeprof-0.15.2/smoke/rbs-attr.rb, line 1
def read_test_1
Foo.new.reader_example
end
# File typeprof-0.15.2/smoke/rbs-attr.rb, line 5
def read_test_2
Foo.new.accessor_example
end
# File typeprof-0.15.2/smoke/manual-rbs.rb, line 12
def ret_int
foo(42)
end
# File typeprof-0.15.2/smoke/manual-rbs.rb, line 16
def ret_str
foo("str")
end
# File typeprof-0.15.2/smoke/array13.rb, line 18
def seq_get
ary = [:a, :b, :c] + []
ary[-1]
end
# File typeprof-0.15.2/smoke/array13.rb, line 12
def seq_set
ary = [:a, :b, :c] + []
ary[-1] = :z
ary
end
# File typeprof-0.15.2/smoke/demo11.rb, line 1
def swap(a)
[a[1], a[0]]
end
# File typeprof-0.15.2/smoke/rbs-record.rb, line 6
def test_bar
h = { }
h[:a] = 42
C.new.bar(h)
end
# File typeprof-0.15.2/smoke/rbs-record.rb, line 1
def test_foo
h = C.new.foo
return h[:aaa], h[:bbb]
end
# File typeprof-0.15.2/smoke/array12.rb, line 4
def test_yield
yield
end
# File typeprof-0.15.2/testbed/ao.rb, line 288
def top
Scene.new.render(IMAGE_WIDTH, IMAGE_HEIGHT, NSUBSAMPLES)
end
# File typeprof-0.15.2/smoke/array13.rb, line 7
def tuple_get
ary = [:a, :b, :c]
ary[-1]
end
# File typeprof-0.15.2/smoke/array13.rb, line 1
def tuple_set
ary = [:a, :b, :c]
ary[-1] = :z
ary
end
# File typeprof-0.15.2/smoke/identifier_keywords.rb, line 1
def type(type)
end