summaryrefslogtreecommitdiff
path: root/benchmark-suite/benchmarks/if.bm
blob: 70aa8debfb2b042ced8e6385ed6def2a463b96aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

(define-module (benchmarks if)
  :use-module (benchmark-suite lib))

(with-benchmark-prefix "if-<expr>-then-else"

  (benchmark "executing then" 330000
    (if (quote #t) #t #f))

  (benchmark "executing else" 330000
    (if (quote #f) #t #f)))

(with-benchmark-prefix "if-<expr>-then"

  (benchmark "executing then" 330000
    (if (quote #t) #t))

  (benchmark "executing else" 330000
    (if (quote #f) #t)))

(with-benchmark-prefix "if-<iloc>-then-else"

  (let ((x #t))
    (benchmark "executing then" 330000
      (if x #t #f)))

  (let ((x #f))
    (benchmark "executing else" 330000
      (if x #t #f))))

(with-benchmark-prefix "if-<iloc>-then"

  (let ((x #t))
    (benchmark "executing then" 330000
      (if x #t)))

  (let ((x #f))
    (benchmark "executing else" 330000
      (if x #t))))

(with-benchmark-prefix "if-<bool>-then-else"

  (benchmark "executing then" 330000
    (if #t #t #f))

  (benchmark "executing else" 330000
    (if #f #t #f)))

(with-benchmark-prefix "if-<bool>-then"

  (benchmark "executing then" 330000
    (if #t #t))

  (benchmark "executing else" 330000
    (if #f #t)))