Merge commit '7c433cbbce83bc9f2f9967afba00bbb68e312657'
[bpt/guile.git] / benchmark-suite / benchmarks / read.bm
index f11ca68..f0b25f5 100644 (file)
@@ -1,6 +1,6 @@
 ;;; read.bm --- Exercise the reader.               -*- Scheme -*-
 ;;;
-;;; Copyright (C) 2008 Free Software Foundation, Inc.
+;;; Copyright (C) 2008, 2010, 2012 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
@@ -27,7 +27,7 @@
        '("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")))
+         "ice-9/psyntax-pp.scm")))
 
 (define (load-file-with-reader file-name reader buffering)
   (with-input-from-file file-name
                      (load-file-with-reader file read buffering))
             %files-to-load))
 
+(define small "\"hello, world!\"")
+(define large (string-append "\"" (make-string 1234 #\A) "\""))
+
+(fluid-set! %default-port-encoding "UTF-8")       ; for string ports
+
 \f
 (with-benchmark-prefix "read"
 
   (benchmark "_IONBF" 5  ;; this one is very slow
     (exercise-read (list _IONBF)))
 
-  (benchmark "_IOLBF" 100
+  (benchmark "_IOLBF" 10
     (exercise-read (list _IOLBF)))
 
-  (benchmark "_IOFBF 4096" 100
+  (benchmark "_IOFBF 4096" 10
     (exercise-read (list _IOFBF 4096)))
 
-  (benchmark "_IOFBF 8192" 100
+  (benchmark "_IOFBF 8192" 10
     (exercise-read (list _IOFBF 8192)))
 
-  (benchmark "_IOFBF 16384" 100
-    (exercise-read (list _IOFBF 16384))))
+  (benchmark "_IOFBF 16384" 10
+    (exercise-read (list _IOFBF 16384)))
+
+  (benchmark "small strings" 100000
+    (call-with-input-string small read))
+
+  (benchmark "large strings" 100000
+    (call-with-input-string large read)))