From e37b362f3e3552b042259d7414b0cb9466445d3a Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Fri, 17 Apr 2015 13:47:22 +0700 Subject: [PATCH] tests: update benchs*.nit to have a common default time and an non-linear grow Signed-off-by: Jean Privat --- tests/bench_421.nit | 2 +- tests/bench_add_all.nit | 9 ++++++--- tests/bench_complex_sort.nit | 2 +- tests/bench_fib.nit | 2 +- tests/bench_int_range_iterator.nit | 2 +- tests/bench_netsim.nit | 4 ++-- tests/bench_nsieve_bool.nit | 4 ++-- tests/bench_send.nit | 6 +++++- tests/bench_send2.nit | 5 ++++- tests/bench_strfib.nit | 2 +- tests/bench_string_append.nit | 2 +- tests/bench_string_super.nit | 7 +++++-- tests/bench_string_tos.nit | 5 ++++- tests/bench_tak.nit | 5 ++++- tests/sav/bench_421.res | 2 +- tests/sav/bench_add_all.res | 2 +- tests/sav/bench_fib.res | 2 +- tests/sav/bench_int_range_iterator.res | 2 +- tests/sav/bench_netsim.res | 2 +- tests/sav/bench_nsieve_bool.res | 6 +++--- tests/sav/bench_strfib.res | 2 +- tests/sav/bench_string_append.res | 6 +++--- tests/sav/bench_string_append_alt1.res | 6 +++--- tests/sav/bench_string_super.res | 2 +- tests/sav/bench_string_tos.res | 2 +- tests/sav/test_hash.res | 4 ++-- tests/sav/test_map.res | 4 ++-- tests/sav/test_mem.res | 2 +- tests/test_map.nit | 2 +- tests/test_mem.nit | 5 ++++- 30 files changed, 65 insertions(+), 43 deletions(-) diff --git a/tests/bench_421.nit b/tests/bench_421.nit index b87347c..a868768 100644 --- a/tests/bench_421.nit +++ b/tests/bench_421.nit @@ -29,7 +29,7 @@ do return steps end -var n = 10 +var n = 456 if not args.is_empty then n = args.first.to_i end diff --git a/tests/bench_add_all.nit b/tests/bench_add_all.nit index 733ac9b..0c9bc5e 100644 --- a/tests/bench_add_all.nit +++ b/tests/bench_add_all.nit @@ -14,16 +14,19 @@ # Performance test for Array::add_all -import standard::collection +var n = 10 +if args.not_empty then n = args.first.to_i + +var nn = 1.lshift(n) var a = new Array[Numeric] var b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] -for i in 10000.times do +for i in nn.times do a.add_all b end var c = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0] -for i in 10000.times do +for i in nn.times do a.add_all c end diff --git a/tests/bench_complex_sort.nit b/tests/bench_complex_sort.nit index 2eef2cb..e05cb45 100644 --- a/tests/bench_complex_sort.nit +++ b/tests/bench_complex_sort.nit @@ -111,7 +111,7 @@ do end end -var n = 100 +var n = 20 if not args.is_empty then n = args.first.to_i diff --git a/tests/bench_fib.nit b/tests/bench_fib.nit index 69dc371..8c7d4da 100644 --- a/tests/bench_fib.nit +++ b/tests/bench_fib.nit @@ -30,7 +30,7 @@ redef class Int end end -var n = 10 +var n = 20 if not args.is_empty then n = args.first.to_i end diff --git a/tests/bench_int_range_iterator.nit b/tests/bench_int_range_iterator.nit index 17f24d2..3d906f0 100644 --- a/tests/bench_int_range_iterator.nit +++ b/tests/bench_int_range_iterator.nit @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -var nb = 5 +var nb = 25 if not args.is_empty then nb = args.first.to_i var cpt = 0 diff --git a/tests/bench_netsim.nit b/tests/bench_netsim.nit index f784635..0e13e59 100644 --- a/tests/bench_netsim.nit +++ b/tests/bench_netsim.nit @@ -267,11 +267,11 @@ e1.attach(a1) b1.start b2.start -var nb = 100000 +var nb = 10 if not args.is_empty then nb = args.first.to_i end -s.run_for(nb) +s.run_for(1.lshift(nb)) print(c1.count) diff --git a/tests/bench_nsieve_bool.nit b/tests/bench_nsieve_bool.nit index 36da71a..634e3cb 100644 --- a/tests/bench_nsieve_bool.nit +++ b/tests/bench_nsieve_bool.nit @@ -38,11 +38,11 @@ end fun test(n: Int) do - var m = 10000.lshift(n) + var m = 1000.lshift(n) print("Primes up to {m} {nsieve(m)}") end -var n = 2 +var n = 3 if args.length == 1 then n = args.first.to_i end diff --git a/tests/bench_send.nit b/tests/bench_send.nit index 03218dc..5659ee1 100644 --- a/tests/bench_send.nit +++ b/tests/bench_send.nit @@ -97,7 +97,11 @@ b.val = 1 c.val = 2 d.val = 3 var i = 0 -while i < 100000 do + +var n = 10 +if args.not_empty then n = args.first.to_i + +while i < 1.lshift(n) do a.hop(b, c, d) i = i + 1 end diff --git a/tests/bench_send2.nit b/tests/bench_send2.nit index e296465..3e8853e 100644 --- a/tests/bench_send2.nit +++ b/tests/bench_send2.nit @@ -53,6 +53,9 @@ class F end +var n = 10 +if args.not_empty then n = args.first.to_i + var nb = 60 var a = new Array[Object].with_capacity(nb) for i in [0..(nb/6)[ do @@ -63,7 +66,7 @@ for i in [0..(nb/6)[ do a[i*6+4] = new E a[i*6+5] = new F end -for i in [0..1000000[ do +for i in [0..1.lshift(n)[ do for j in [0..nb[ do a[j].foo end diff --git a/tests/bench_strfib.nit b/tests/bench_strfib.nit index 2357686..f65d436 100644 --- a/tests/bench_strfib.nit +++ b/tests/bench_strfib.nit @@ -32,7 +32,7 @@ if args.has("-q") then args.remove("-q") end -var n = 5 +var n = 15 if args.length > 0 then n = args.first.to_i var res = strfib(n) diff --git a/tests/bench_string_append.nit b/tests/bench_string_append.nit index c99dc83..df00536 100644 --- a/tests/bench_string_append.nit +++ b/tests/bench_string_append.nit @@ -17,7 +17,7 @@ #alt1 import standard #alt1 import standard::ropes -var n = 7 +var n = 4 if not args.is_empty then n = args.first.to_i end diff --git a/tests/bench_string_super.nit b/tests/bench_string_super.nit index ad27304..c78f448 100644 --- a/tests/bench_string_super.nit +++ b/tests/bench_string_super.nit @@ -14,9 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +var n = 10 +if args.not_empty then n = args.first.to_i + var s = "*" -var i = 0 -while i < 8 do +var i = 1 +while i < n do s = "Je dis «{s}» et redis «{s}» et trois fois de plus : «{s}{s}{s}».\n" i = i + 1 end diff --git a/tests/bench_string_tos.nit b/tests/bench_string_tos.nit index 1d59691..dbc8ac9 100644 --- a/tests/bench_string_tos.nit +++ b/tests/bench_string_tos.nit @@ -14,9 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +var n = 10 +if args.not_empty then n = args.first.to_i + var s = "*" var i = 0 -while i < 8 do +while i < n do s = ["Je dis «", s, "» et redis «", s, "» et trois fois de plus : «", s, s, s, "».\n"].to_s i = i + 1 end diff --git a/tests/bench_tak.nit b/tests/bench_tak.nit index d5be5e8..ac128d3 100644 --- a/tests/bench_tak.nit +++ b/tests/bench_tak.nit @@ -27,4 +27,7 @@ do end end -print(tak(37,12,6)) +var n = 17 +if args.not_empty then n = args.first.to_i + +print(tak(n,12,6)) diff --git a/tests/sav/bench_421.res b/tests/sav/bench_421.res index 5079bf7..4e2232f 100644 --- a/tests/sav/bench_421.res +++ b/tests/sav/bench_421.res @@ -1 +1 @@ -9: 19 +327: 143 diff --git a/tests/sav/bench_add_all.res b/tests/sav/bench_add_all.res index 87766d8..f3be39f 100644 --- a/tests/sav/bench_add_all.res +++ b/tests/sav/bench_add_all.res @@ -1 +1 @@ -200000 +20480 diff --git a/tests/sav/bench_fib.res b/tests/sav/bench_fib.res index c3f407c..de05920 100644 --- a/tests/sav/bench_fib.res +++ b/tests/sav/bench_fib.res @@ -1 +1 @@ -55 +6765 diff --git a/tests/sav/bench_int_range_iterator.res b/tests/sav/bench_int_range_iterator.res index 7ed6ff8..7273c0f 100644 --- a/tests/sav/bench_int_range_iterator.res +++ b/tests/sav/bench_int_range_iterator.res @@ -1 +1 @@ -5 +25 diff --git a/tests/sav/bench_netsim.res b/tests/sav/bench_netsim.res index dc83631..0f3d3bb 100644 --- a/tests/sav/bench_netsim.res +++ b/tests/sav/bench_netsim.res @@ -1,2 +1,2 @@ Time limit. -28570 +292 diff --git a/tests/sav/bench_nsieve_bool.res b/tests/sav/bench_nsieve_bool.res index d9e91fa..134debf 100644 --- a/tests/sav/bench_nsieve_bool.res +++ b/tests/sav/bench_nsieve_bool.res @@ -1,3 +1,3 @@ -Primes up to 40000 4203 -Primes up to 20000 2262 -Primes up to 10000 1229 +Primes up to 8000 1007 +Primes up to 4000 550 +Primes up to 2000 303 diff --git a/tests/sav/bench_strfib.res b/tests/sav/bench_strfib.res index 4e58388..aa267d1 100644 --- a/tests/sav/bench_strfib.res +++ b/tests/sav/bench_strfib.res @@ -1 +1 @@ -((()(()))((())(()(())))) +(((((((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))))(((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(())))))))((((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))))))((((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(())))))))((((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(())))))))))(((((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))))(((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(())))))))((((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))))))))(((((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(())))))))((((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(())))))))))(((((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))))(((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(())))))))((((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(())))))))))))((((((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))))(((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(())))))))((((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))))))((((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(())))))))((((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(())))))))))(((((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))))(((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(())))))))((((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(()))))))((((())(()(())))((()(()))((())(()(())))))(((()(()))((())(()(()))))(((())(()(())))((()(()))((())(()(())))))))))))))) diff --git a/tests/sav/bench_string_append.res b/tests/sav/bench_string_append.res index 24c2167..0abbce4 100644 --- a/tests/sav/bench_string_append.res +++ b/tests/sav/bench_string_append.res @@ -1,3 +1,3 @@ -1092 -1365 -147447 +17 +21 +2295 diff --git a/tests/sav/bench_string_append_alt1.res b/tests/sav/bench_string_append_alt1.res index 24c2167..0abbce4 100644 --- a/tests/sav/bench_string_append_alt1.res +++ b/tests/sav/bench_string_append_alt1.res @@ -1,3 +1,3 @@ -1092 -1365 -147447 +17 +21 +2295 diff --git a/tests/sav/bench_string_super.res b/tests/sav/bench_string_super.res index e64f947..db34647 100644 --- a/tests/sav/bench_string_super.res +++ b/tests/sav/bench_string_super.res @@ -1 +1 @@ -5859361 +29296861 diff --git a/tests/sav/bench_string_tos.res b/tests/sav/bench_string_tos.res index e64f947..2271475 100644 --- a/tests/sav/bench_string_tos.res +++ b/tests/sav/bench_string_tos.res @@ -1 +1 @@ -5859361 +146484361 diff --git a/tests/sav/test_hash.res b/tests/sav/test_hash.res index dc72c30..5cbab16 100644 --- a/tests/sav/test_hash.res +++ b/tests/sav/test_hash.res @@ -11,8 +11,8 @@ true 2 0 * test 2 * -1000 -334 +100 +34 * test 3 * * start: true diff --git a/tests/sav/test_map.res b/tests/sav/test_map.res index dabb78b..48cdded 100644 --- a/tests/sav/test_map.res +++ b/tests/sav/test_map.res @@ -10,8 +10,8 @@ true 2 0 * test 2 * -1000 -334 +100 +34 * test 3 * * start: true diff --git a/tests/sav/test_mem.res b/tests/sav/test_mem.res index a9be79e..2a5b99a 100644 --- a/tests/sav/test_mem.res +++ b/tests/sav/test_mem.res @@ -1 +1 @@ -1234567891011121314151617181920212223 +12345678910 diff --git a/tests/test_map.nit b/tests/test_map.nit index c5b9eea..8e147f7 100644 --- a/tests/test_map.nit +++ b/tests/test_map.nit @@ -40,7 +40,7 @@ end fun test2(h: Map[Int, Int]) do print("* test 2 *") - var nb = 999 + var nb = 99 var i = 0 while i <= nb do diff --git a/tests/test_mem.nit b/tests/test_mem.nit index 9487e82..dc9d167 100644 --- a/tests/test_mem.nit +++ b/tests/test_mem.nit @@ -27,4 +27,7 @@ fun foo(n: Int): List[Int] return a end -print(foo(23)) +var n = 10 +if args.not_empty then n = args.first.to_i + +print(foo(n)) -- 1.7.9.5