blob: cb876b5ad68ba1a0cbed408f955ac4f07f4fdf0d (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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))))
|