diff options
author | Ludovic Courtès <ludo@gnu.org> | 2009-12-11 12:58:06 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2009-12-11 13:03:46 +0100 |
commit | f680bdd762f164ead068dcc53d14b7bd77f797b8 (patch) | |
tree | 36b8495db7bb044d4b07444797303617cdcec8c9 /benchmark-suite | |
parent | bd91ecce14c8df1022d4f7225888906541556570 (diff) |
Add struct & vector benchmarks.
* benchmark-suite/benchmarks/structs.bm,
benchmark-suite/benchmarks/vectors.bm: New files.
* benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add.
* benchmark-suite/benchmarks/bytevectors.bm: Fix copyright.
Diffstat (limited to 'benchmark-suite')
-rw-r--r-- | benchmark-suite/Makefile.am | 4 | ||||
-rw-r--r-- | benchmark-suite/benchmarks/bytevectors.bm | 5 | ||||
-rw-r--r-- | benchmark-suite/benchmarks/structs.bm | 68 | ||||
-rw-r--r-- | benchmark-suite/benchmarks/vectors.bm | 51 |
4 files changed, 124 insertions, 4 deletions
diff --git a/benchmark-suite/Makefile.am b/benchmark-suite/Makefile.am index dc35ed929..a9da00e72 100644 --- a/benchmark-suite/Makefile.am +++ b/benchmark-suite/Makefile.am @@ -4,8 +4,10 @@ SCM_BENCHMARKS = benchmarks/0-reference.bm \ benchmarks/if.bm \ benchmarks/logand.bm \ benchmarks/read.bm \ + benchmarks/structs.bm \ benchmarks/subr.bm \ - benchmarks/uniform-vector-read.bm + benchmarks/uniform-vector-read.bm \ + benchmarks/vectors.bm EXTRA_DIST = guile-benchmark lib.scm $(SCM_BENCHMARKS) \ ChangeLog-2008 diff --git a/benchmark-suite/benchmarks/bytevectors.bm b/benchmark-suite/benchmarks/bytevectors.bm index 06f23ef3b..66c88aa3e 100644 --- a/benchmark-suite/benchmarks/bytevectors.bm +++ b/benchmark-suite/benchmarks/bytevectors.bm @@ -1,8 +1,7 @@ -;;; coding: latin1 -*- mode: scheme; coding: latin-1; -*- +;;; -*- mode: scheme; coding: iso-8859-1; -*- ;;; R6RS Byte Vectors. ;;; -;;; Copyright 2009 Ludovic Courtès <ludo@gnu.org> -;;; +;;; Copyright 2009 Free Software Foundation, Inc. ;;; ;;; This program is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU Lesser General Public License diff --git a/benchmark-suite/benchmarks/structs.bm b/benchmark-suite/benchmarks/structs.bm new file mode 100644 index 000000000..65c8e975e --- /dev/null +++ b/benchmark-suite/benchmarks/structs.bm @@ -0,0 +1,68 @@ +;;; -*- mode: scheme; coding: iso-8859-1; -*- +;;; Structs. +;;; +;;; Copyright 2009 Free Software Foundation, Inc. +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU Lesser General Public License +;;; as published by the Free Software Foundation; either version 3, or +;;; (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU Lesser General Public License for more details. +;;; +;;; You should have received a copy of the GNU Lesser General Public +;;; License along with this software; see the file COPYING.LESSER. If +;;; not, write to the Free Software Foundation, Inc., 51 Franklin +;;; Street, Fifth Floor, Boston, MA 02110-1301 USA + +(define-module (benchmarks structs) + :use-module (benchmark-suite lib)) + +;; Note: Use `--iteration-factor' to change this. +(define iterations 2000000) + +(define vtable2 + (make-vtable "prpr")) + +(define vtable7 + (make-vtable (string-concatenate (make-list 7 "pr")))) + + +(with-benchmark-prefix "constructors" + + (benchmark "make-struct2 (opcode)" iterations + (make-struct vtable2 0 1 2)) + + (benchmark "make-struct2 (procedure)" iterations + (let ((s make-struct)) + (s vtable2 0 1 2))) + + (benchmark "make-struct7 (opcode)" iterations + (make-struct vtable7 0 1 2 3 4 5 6 7)) + + (benchmark "make-struct7 (procedure)" iterations + (let ((s make-struct)) + (s vtable7 0 1 2 3 4 5 6 7)))) + + +(with-benchmark-prefix "pairs" ;; for comparison + + (benchmark "cons (opcode)" iterations + (cons 1 2)) + + (benchmark "cons (procedure)" iterations + (let ((c cons)) + (c 1 2))) + + (benchmark "list (opcode)" iterations + (list 1 2 3 4 5 6 7)) + + (benchmark "list (procedure)" iterations + (let ((l list)) + (l 1 2 3 4 5 6 7))) + + (benchmark "make-list" iterations + (make-list 7))) diff --git a/benchmark-suite/benchmarks/vectors.bm b/benchmark-suite/benchmarks/vectors.bm new file mode 100644 index 000000000..4e47e008c --- /dev/null +++ b/benchmark-suite/benchmarks/vectors.bm @@ -0,0 +1,51 @@ +;;; -*- mode: scheme; coding: iso-8859-1; -*- +;;; Vectors. +;;; +;;; Copyright 2009 Free Software Foundation, Inc. +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU Lesser General Public License +;;; as published by the Free Software Foundation; either version 3, or +;;; (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU Lesser General Public License for more details. +;;; +;;; You should have received a copy of the GNU Lesser General Public +;;; License along with this software; see the file COPYING.LESSER. If +;;; not, write to the Free Software Foundation, Inc., 51 Franklin +;;; Street, Fifth Floor, Boston, MA 02110-1301 USA + +(define-module (benchmarks vectors) + :use-module (benchmark-suite lib)) + +;; Note: Use `--iteration-factor' to change this. +(define iterations 1000000) + + +(with-benchmark-prefix "constructors" + + (benchmark "vector (opcode)" iterations + (vector 1 2 3 4 5 6 7)) + + (benchmark "vector (procedure)" iterations + (let ((v vector)) + (v 1 2 3 4 5 6 7))) + + (benchmark "make-vector" iterations + (make-vector 7))) + + +(with-benchmark-prefix "pairs" ;; for comparison + + (benchmark "list (opcode)" iterations + (list 1 2 3 4 5 6 7)) + + (benchmark "list (procedure)" iterations + (let ((l list)) + (l 1 2 3 4 5 6 7))) + + (benchmark "make-list" iterations + (make-list 7))) |