mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-14 23:50:19 +02:00
Add GC benchmarks.
This commit is contained in:
parent
074f69cdf2
commit
c38a561f73
5 changed files with 402 additions and 0 deletions
25
gc-benchmarks/string.scm
Normal file
25
gc-benchmarks/string.scm
Normal file
|
@ -0,0 +1,25 @@
|
|||
;;; From from http://www.ccs.neu.edu/home/will/Twobit/KVW/string.txt .
|
||||
; string test
|
||||
; (try 100000)
|
||||
|
||||
(define s "abcdef")
|
||||
|
||||
(define (grow)
|
||||
(set! s (string-append "123" s "456" s "789"))
|
||||
(set! s (string-append
|
||||
(substring s (quotient (string-length s) 2) (string-length s))
|
||||
(substring s 0 (+ 1 (quotient (string-length s) 2)))))
|
||||
s)
|
||||
|
||||
(define (trial n)
|
||||
(do ((i 0 (+ i 1)))
|
||||
((> (string-length s) n) (string-length s))
|
||||
(grow)))
|
||||
|
||||
(define (try n)
|
||||
(do ((i 0 (+ i 1)))
|
||||
((>= i 10) (string-length s))
|
||||
(set! s "abcdef")
|
||||
(trial n)))
|
||||
|
||||
(try 50000000)
|
Loading…
Add table
Add a link
Reference in a new issue