3 ;; A library of dumb functions that may be used to benchmark Guile-VM.
6 ;; The comments are from Ludovic, a while ago. The speedups now are much
7 ;; more significant (all over 2x, sometimes 8x).
10 (if (or (= x 1) (= x 2))
23 ;; This one shows that procedure calls are no faster than within the
24 ;; interpreter: the VM yields no performance improvement.
29 ;; Disassembly of `loop'
31 ;; Disassembly of #<objcode b79bdf28>:
33 ;; nlocs = 0 nexts = 0
35 ;; 0 (make-int8 64) ;; 64
36 ;; 2 (load-symbol "guile-user") ;; guile-user
37 ;; 14 (list 0 1) ;; 1 element
38 ;; 17 (load-symbol "loop") ;; loop
40 ;; 24 (vector 0 1) ;; 1 element
41 ;; 27 (make-int8 0) ;; 0
42 ;; 29 (load-symbol "n") ;; n
43 ;; 32 (make-false) ;; #f
44 ;; 33 (make-int8 0) ;; 0
45 ;; 35 (list 0 3) ;; 3 elements
46 ;; 38 (list 0 2) ;; 2 elements
47 ;; 41 (list 0 1) ;; 1 element
48 ;; 44 (make-int8 5) ;; 5
49 ;; 46 (make-false) ;; #f
51 ;; 48 (make-int8 18) ;; 18
52 ;; 50 (make-false) ;; #f
54 ;; 52 (make-int8 20) ;; 20
55 ;; 54 (make-false) ;; #f
57 ;; 56 (list 0 4) ;; 4 elements
58 ;; 59 (load-program ##{66}#)
66 ;; 0 (make-int8 0) ;; 0
69 ;; 5 (br-if-not 0 3) ;; -> 11
70 ;; 8 (make-int8 0) ;; 0
72 ;; 11 (toplevel-ref 0)
74 ;; 15 (make-int8 1) ;; 1
86 ;; Same as `loop' using `do'.
94 ;; This one shows that the built-in `cons' instruction yields a significant
95 ;; improvement (speedup: 1.5).
100 (loop (1- x) (cons x result)))))
102 (define big-list (iota 500000))
104 (define (copy-list lst)
111 (cons (car lst) result)))))