1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

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.
This commit is contained in:
Ludovic Courtès 2009-12-11 12:58:06 +01:00
parent bd91ecce14
commit f680bdd762
4 changed files with 124 additions and 4 deletions

View file

@ -4,8 +4,10 @@ SCM_BENCHMARKS = benchmarks/0-reference.bm \
benchmarks/if.bm \ benchmarks/if.bm \
benchmarks/logand.bm \ benchmarks/logand.bm \
benchmarks/read.bm \ benchmarks/read.bm \
benchmarks/structs.bm \
benchmarks/subr.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) \ EXTRA_DIST = guile-benchmark lib.scm $(SCM_BENCHMARKS) \
ChangeLog-2008 ChangeLog-2008

View file

@ -1,8 +1,7 @@
;;; coding: latin1 -*- mode: scheme; coding: latin-1; -*- ;;; -*- mode: scheme; coding: iso-8859-1; -*-
;;; R6RS Byte Vectors. ;;; 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 ;;; This program is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License ;;; modify it under the terms of the GNU Lesser General Public License

View file

@ -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)))

View file

@ -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)))