Merge commit '5af307de43e4b65eec7f235b48a8908f2a00f134'
[bpt/guile.git] / benchmark-suite / benchmarks / vectors.bm
CommitLineData
f680bdd7
LC
1;;; -*- mode: scheme; coding: iso-8859-1; -*-
2;;; Vectors.
3;;;
4;;; Copyright 2009 Free Software Foundation, Inc.
5;;;
6;;; This program is free software; you can redistribute it and/or
7;;; modify it under the terms of the GNU Lesser General Public License
8;;; as published by the Free Software Foundation; either version 3, or
9;;; (at your option) any later version.
10;;;
11;;; This program is distributed in the hope that it will be useful,
12;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU Lesser General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU Lesser General Public
17;;; License along with this software; see the file COPYING.LESSER. If
18;;; not, write to the Free Software Foundation, Inc., 51 Franklin
19;;; Street, Fifth Floor, Boston, MA 02110-1301 USA
20
21(define-module (benchmarks vectors)
22 :use-module (benchmark-suite lib))
23
24;; Note: Use `--iteration-factor' to change this.
25(define iterations 1000000)
26
27\f
28(with-benchmark-prefix "constructors"
29
30 (benchmark "vector (opcode)" iterations
31 (vector 1 2 3 4 5 6 7))
32
33 (benchmark "vector (procedure)" iterations
34 (let ((v vector))
35 (v 1 2 3 4 5 6 7)))
36
37 (benchmark "make-vector" iterations
38 (make-vector 7)))
39
40\f
41(with-benchmark-prefix "pairs" ;; for comparison
42
43 (benchmark "list (opcode)" iterations
44 (list 1 2 3 4 5 6 7))
45
46 (benchmark "list (procedure)" iterations
47 (let ((l list))
48 (l 1 2 3 4 5 6 7)))
49
50 (benchmark "make-list" iterations
51 (make-list 7)))