block version of loop
no debugging, just worked! only about 10% slower, nice also recording qemu-linux times, which are a lot faster(and double bonus, save the startup/syncing)
This commit is contained in:
parent
4676019702
commit
c0a3c9b65c
@ -9,3 +9,5 @@ class Space
|
||||
return b
|
||||
end
|
||||
end
|
||||
# 9.5 local
|
||||
# 45 on pi
|
||||
|
@ -3,3 +3,6 @@ class Space
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
# 5.5 local
|
||||
# 42 on pi
|
||||
|
17
test/bench/rubyx/times.rb
Normal file
17
test/bench/rubyx/times.rb
Normal file
@ -0,0 +1,17 @@
|
||||
class Space
|
||||
def times(n)
|
||||
i = 0
|
||||
while( i < n )
|
||||
yield
|
||||
i = i + 1
|
||||
end
|
||||
return n
|
||||
end
|
||||
def main(arg)
|
||||
return times(100000) {
|
||||
return 1
|
||||
}
|
||||
end
|
||||
end
|
||||
# 13 local
|
||||
# 51 on pi
|
15
test/mains/source/times_11111_5.rb
Normal file
15
test/mains/source/times_11111_5.rb
Normal file
@ -0,0 +1,15 @@
|
||||
class Space
|
||||
def times(n)
|
||||
i = 0
|
||||
while( i < n )
|
||||
yield
|
||||
i = i + 1
|
||||
end
|
||||
return n
|
||||
end
|
||||
def main(arg)
|
||||
return times(5) {
|
||||
"1".putstring
|
||||
}
|
||||
end
|
||||
end
|
@ -1,10 +1,10 @@
|
||||
require_relative 'helper'
|
||||
|
||||
# The "New" in this TestNew means that this is the place to develop a new test for the mains dir.
|
||||
# If you just pop a file in the source directory, all tests will run. (Well, actually guard does
|
||||
# not pick up changes on that source dir yet, but when you run it manually, all tests run)
|
||||
# The "New" in this TestNew means that this is the place to develop a new test for the
|
||||
# mains dir.
|
||||
# If you just pop a file in the source directory, all tests will run.
|
||||
# This is fine if all is fine. But if all is fine, you are not developing, just playing.
|
||||
# So when you really need to itereate this editing this gives guard auto-run and just of that
|
||||
# So when you really need to itereate editing this gives guard auto-run and just of that
|
||||
# one test that you work on.
|
||||
|
||||
# After getting the test to run, copy paste the whole code into a file in source and revert
|
||||
@ -17,11 +17,20 @@ module Mains
|
||||
def whole_input
|
||||
<<-eos
|
||||
class Space
|
||||
def self.simple
|
||||
return 2 + 2
|
||||
def times
|
||||
n = 5
|
||||
i = 0
|
||||
while( i < 5 )
|
||||
yield
|
||||
i = i + 1
|
||||
end
|
||||
return 1
|
||||
end
|
||||
def main(arg)
|
||||
return Space.simple
|
||||
times{
|
||||
"1".putstring
|
||||
}
|
||||
return 4
|
||||
end
|
||||
end
|
||||
eos
|
||||
@ -35,6 +44,7 @@ module Mains
|
||||
run_all
|
||||
assert_equal ::Integer , get_return.class , " "
|
||||
assert_equal 4 , get_return , " "
|
||||
assert_equal "hi" , @interpreter.stdout
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user