diff options
author | Ludovic Courtès <ludo@gnu.org> | 2008-04-17 10:04:09 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2008-04-17 10:24:10 +0200 |
commit | 6bb1dc98b9faecfc9943b724f5f99e3e0aa39340 (patch) | |
tree | 52e6fb08cffd50728f0e4351e1a6ad5f0b422514 /benchmark-suite | |
parent | be10cba84b4ab85a89cb8e4f30281d40820b4f5f (diff) |
Add `read' benchmark.
Diffstat (limited to 'benchmark-suite')
-rw-r--r-- | benchmark-suite/ChangeLog | 5 | ||||
-rw-r--r-- | benchmark-suite/Makefile.am | 9 | ||||
-rw-r--r-- | benchmark-suite/benchmarks/read.bm | 62 |
3 files changed, 72 insertions, 4 deletions
diff --git a/benchmark-suite/ChangeLog b/benchmark-suite/ChangeLog index f4356a9c3..fcfedc2de 100644 --- a/benchmark-suite/ChangeLog +++ b/benchmark-suite/ChangeLog @@ -1,3 +1,8 @@ +2008-04-17 Ludovic Courtès <ludo@gnu.org> + + * Makefile.am (SCM_BENCHMARKS): Add `benchmarks/read.bm'. + * benchmarks/read.bm: New file. + 2008-01-22 Neil Jerram <neil@ossau.uklinux.net> * COPYING: Removed. diff --git a/benchmark-suite/Makefile.am b/benchmark-suite/Makefile.am index 464150a5c..a8f471996 100644 --- a/benchmark-suite/Makefile.am +++ b/benchmark-suite/Makefile.am @@ -1,6 +1,7 @@ -SCM_BENCHMARKS = benchmarks/0-reference.bm \ - benchmarks/continuations.bm \ - benchmarks/if.bm \ - benchmarks/logand.bm +SCM_BENCHMARKS = benchmarks/0-reference.bm \ + benchmarks/continuations.bm \ + benchmarks/if.bm \ + benchmarks/logand.bm \ + benchmarks/read.bm EXTRA_DIST = guile-benchmark lib.scm $(SCM_BENCHMARKS) diff --git a/benchmark-suite/benchmarks/read.bm b/benchmark-suite/benchmarks/read.bm new file mode 100644 index 000000000..cb876b5ad --- /dev/null +++ b/benchmark-suite/benchmarks/read.bm @@ -0,0 +1,62 @@ +;;; read.bm --- Exercise the reader. -*- Scheme -*- +;;; +;;; Copyright (C) 2008 Free Software Foundation, Inc. +;;; +;;; This program is free software; you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 2, 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 General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this software; see the file COPYING. If not, write to +;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;;; Boston, MA 02110-1301 USA + +(define-module (benchmarks read) + :use-module (benchmark-suite lib)) + + +(define %files-to-load + ;; Various large Scheme files. + (map %search-load-path + '("ice-9/boot-9.scm" "ice-9/common-list.scm" + "ice-9/format.scm" "ice-9/optargs.scm" + "ice-9/session.scm" "ice-9/getopt-long.scm" + "ice-9/psyntax.pp"))) + +(define (load-file-with-reader file-name reader buffering) + (with-input-from-file file-name + (lambda () + (apply setvbuf (current-input-port) buffering) + (let loop ((sexp (reader))) + (if (eof-object? sexp) + #t + (loop (reader))))))) + +(define (exercise-read buffering) + (for-each (lambda (file) + (load-file-with-reader file read buffering)) + %files-to-load)) + + +(with-benchmark-prefix "read" + + (benchmark "_IONBF" 5 ;; this one is very slow + (exercise-read (list _IONBF))) + + (benchmark "_IOLBF" 100 + (exercise-read (list _IOLBF))) + + (benchmark "_IOFBF 4096" 100 + (exercise-read (list _IOFBF 4096))) + + (benchmark "_IOFBF 8192" 100 + (exercise-read (list _IOFBF 8192))) + + (benchmark "_IOFBF 16384" 100 + (exercise-read (list _IOFBF 16384)))) |