rdelim: Speed up 'read-string' (aka. 'get-string-all'.)
[bpt/guile.git] / benchmark-suite / benchmarks / read.bm
index 7bc8150..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"
 
     (exercise-read (list _IOFBF 8192)))
 
   (benchmark "_IOFBF 16384" 10
-    (exercise-read (list _IOFBF 16384))))
+    (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)))