benchmark lambda lifting
svn: r3851
This commit is contained in:
parent
582d68347c
commit
94e726f309
62
collects/tests/mzscheme/benchmarks/common/nestedloop.sch
Normal file
62
collects/tests/mzscheme/benchmarks/common/nestedloop.sch
Normal file
|
@ -0,0 +1,62 @@
|
|||
|
||||
(define (loops n)
|
||||
(let ((result 0))
|
||||
(let loop1 ((i1 1))
|
||||
(if (> i1 n)
|
||||
'done
|
||||
(begin
|
||||
(let loop2 ((i2 1))
|
||||
(if (> i2 n)
|
||||
'done
|
||||
(begin
|
||||
(let loop3 ((i3 1))
|
||||
(if (> i3 n)
|
||||
'done
|
||||
(begin
|
||||
(let loop4 ((i4 1))
|
||||
(if (> i4 n)
|
||||
'done
|
||||
(begin
|
||||
(let loop5 ((i5 1))
|
||||
(if (> i5 n)
|
||||
'done
|
||||
(begin
|
||||
(let loop6 ((i6 1))
|
||||
(if (> i6 n)
|
||||
'done
|
||||
(begin
|
||||
(set! result (+ result 1))
|
||||
(loop6 (+ i6 1)))))
|
||||
(loop5 (+ i5 1)))))
|
||||
(loop4 (+ i4 1)))))
|
||||
(loop3 (+ i3 1)))))
|
||||
(loop2 (+ i2 1)))))
|
||||
(loop1 (+ i1 1)))))
|
||||
result))
|
||||
|
||||
|
||||
(define (func-loops n)
|
||||
(let loop1 ((i1 1)(result 0))
|
||||
(if (> i1 n)
|
||||
result
|
||||
(let loop2 ((i2 1)(result result))
|
||||
(if (> i2 n)
|
||||
(loop1 (+ i1 1) result)
|
||||
(let loop3 ((i3 1)(result result))
|
||||
(if (> i3 n)
|
||||
(loop2 (+ i2 1) result)
|
||||
(let loop4 ((i4 1)(result result))
|
||||
(if (> i4 n)
|
||||
(loop3 (+ i3 1) result)
|
||||
(let loop5 ((i5 1)(result result))
|
||||
(if (> i5 n)
|
||||
(loop4 (+ i4 1) result)
|
||||
(let loop6 ((i6 1)(result result))
|
||||
(if (> i6 n)
|
||||
(loop5 (+ i5 1) result)
|
||||
(loop6 (+ i6 1) (+ result 1)))))))))))))))
|
||||
|
||||
(display (time (loops 18))) (newline)
|
||||
(display (time (func-loops 18))) (newline)
|
||||
|
||||
|
2
collects/tests/mzscheme/benchmarks/common/nestedloop.ss
Normal file
2
collects/tests/mzscheme/benchmarks/common/nestedloop.ss
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
(module nestedloop "wrap.ss")
|
|
@ -38,11 +38,11 @@
|
|||
(or (state0 (string->list input))
|
||||
'fail))
|
||||
|
||||
(time (let ([input (string-append (make-string 133 #\a) "bc")])
|
||||
(let loop ([n 10000])
|
||||
(time (let ((input (string-append (make-string 133 #\a) "bc")))
|
||||
(let loop ((n 10000))
|
||||
(unless (zero? n)
|
||||
(recursive-nfa input)
|
||||
(loop (sub1 n))))))
|
||||
(loop (- n 1))))))
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user