mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
* libguile/ports.c (scm_setvbuf): Use the symbols `none', `line', and `block' instead of the values `_IONBF', `_IOLBF', and `_IOFBF'. * NEWS: Update. * doc/ref/posix.texi (Ports and File Descriptors): Update setvbuf documentation. * module/ice-9/deprecated.scm (define-deprecated): New helper. (_IONBF, _IOLBF, _IOFBF): Define deprecated values. * benchmark-suite/benchmarks/read.bm ("read"): * benchmark-suite/benchmarks/uniform-vector-read.bm ("uniform-vector-read!"): * libguile/r6rs-ports.c (cbip_fill_input): * module/system/base/types.scm (%ffi-memory-backend): * module/web/client.scm (open-socket-for-uri): * module/web/server/http.scm (http-read): * test-suite/tests/ports.test ("pipe, fdopen, and line buffering"): ("setvbuf"): * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports"): Update to use non-deprecated interfaces.
73 lines
2.3 KiB
Scheme
73 lines
2.3 KiB
Scheme
;;; read.bm --- Exercise the reader. -*- Scheme -*-
|
||
;;;
|
||
;;; 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
|
||
;;; 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.scm")))
|
||
|
||
(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))
|
||
|
||
(define small "\"hello, world!\"")
|
||
(define large (string-append "\"" (make-string 1234 #\A) "\""))
|
||
|
||
(fluid-set! %default-port-encoding "UTF-8") ; for string ports
|
||
|
||
|
||
(with-benchmark-prefix "read"
|
||
|
||
(benchmark "'none" 5 ;; this one is very slow
|
||
(exercise-read (list 'none)))
|
||
|
||
(benchmark "'line" 10
|
||
(exercise-read (list 'line)))
|
||
|
||
(benchmark "'block 4096" 10
|
||
(exercise-read (list 'block 4096)))
|
||
|
||
(benchmark "'block 8192" 10
|
||
(exercise-read (list 'block 8192)))
|
||
|
||
(benchmark "'block 16384" 10
|
||
(exercise-read (list 'block 16384)))
|
||
|
||
(benchmark "small strings" 100000
|
||
(call-with-input-string small read))
|
||
|
||
(benchmark "large strings" 100000
|
||
(call-with-input-string large read)))
|