~peter-pearse/ubuntu/natty/guile-1.8/prop001

« back to all changes in this revision

Viewing changes to benchmark-suite/benchmarks/uniform-vector-read.bm

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2009-06-04 19:01:38 UTC
  • mfrom: (8.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090604190138-1ao3t6sj31cqvcfe
Tags: 1.8.6+1-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Build with -Wno-error.
  - Build with thread support. Some guile-using programs like autogen need it.
  - Add debian/guile-1.8-libs.shlibs: Thread support breaks ABI, bump the soname.
* Dropped changes:
  - libltdl3-dev -> libltdl7-dev: current libltdl-dev Provides: both.
  - debian/patches/libtool-ftbfs.diff: integrated upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;;; uniform-vector-read.bm --- Exercise binary I/O primitives.  -*- Scheme -*-
 
2
;;;
 
3
;;; Copyright (C) 2008 Free Software Foundation, Inc.
 
4
;;;
 
5
;;; This program is free software; you can redistribute it and/or modify
 
6
;;; it under the terms of the GNU General Public License as published by
 
7
;;; the Free Software Foundation; either version 2, or (at your option)
 
8
;;; any later version.
 
9
;;;
 
10
;;; This program is distributed in the hope that it will be useful,
 
11
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
;;; GNU General Public License for more details.
 
14
;;;
 
15
;;; You should have received a copy of the GNU General Public License
 
16
;;; along with this software; see the file COPYING.  If not, write to
 
17
;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
;;; Boston, MA 02110-1301 USA
 
19
 
 
20
(define-module (benchmarks uniform-vector-read)
 
21
  :use-module (benchmark-suite lib)
 
22
  :use-module (srfi srfi-4))
 
23
 
 
24
(define file-name
 
25
  (tmpnam))
 
26
 
 
27
(define %buffer-size
 
28
  7777)
 
29
 
 
30
(define buf
 
31
  (make-u8vector %buffer-size))
 
32
 
 
33
(define str
 
34
  (make-string %buffer-size))
 
35
 
 
36
 
 
37
(with-benchmark-prefix "uniform-vector-read!"
 
38
 
 
39
  (benchmark "uniform-vector-write" 500
 
40
    (let ((output (open-output-file file-name)))
 
41
      (uniform-vector-write buf output)
 
42
      (close output)))
 
43
 
 
44
  (benchmark "uniform-vector-read!" 500
 
45
    (let ((input (open-input-file file-name)))
 
46
      (setvbuf input _IONBF)
 
47
      (uniform-vector-read! buf input)
 
48
      (close input)))
 
49
 
 
50
  (benchmark "string port" 5000
 
51
    (let ((input (open-input-string str)))
 
52
      (uniform-vector-read! buf input)
 
53
      (close input))))