1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00
guile/benchmark-suite/benchmarks/read.bm
Neil Jerram 5904704335 Changes so that benchmark-guile runs successfully
* benchmark-suite/benchmarks/bytevectors.bm: Add "coding: latin1"
  comment where Guile will find it.

* benchmark-suite/benchmarks/chars.bm: Ditto.

* benchmark-suite/benchmarks/srfi-13.bm: Ditto.

* benchmark-suite/benchmarks/read.bm ("read"): Divide numbers of
  iterations by 10, so that the benchmarks complete within a few
  minutes.

* benchmark-suite/lib.scm (benchmark): Use `run-benchmark' in macro
  definition, not `,run-benchmark'.

* benchmark-suite/benchmarks/0-reference.bm,
  benchmark-suite/benchmarks/continuations.bm,
  benchmark-suite/benchmarks/if.bm,
  benchmark-suite/benchmarks/logand.bm: Add define-module.

* benchmark-suite/results/neil-arudy: New file, containing benchmark
  results from my computer.
2009-09-22 00:39:57 +01:00

62 lines
2 KiB
Scheme
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;; 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 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 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" 10
(exercise-read (list _IOLBF)))
(benchmark "_IOFBF 4096" 10
(exercise-read (list _IOFBF 4096)))
(benchmark "_IOFBF 8192" 10
(exercise-read (list _IOFBF 8192)))
(benchmark "_IOFBF 16384" 10
(exercise-read (list _IOFBF 16384))))