unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: daniel.llorens@bluewin.ch
To: guile-devel@gnu.org
Subject: [PATCH 2/6] Replace uniform-vector-read benchmark with bytevector-io benchmark
Date: Mon, 13 Feb 2017 15:04:24 +0100	[thread overview]
Message-ID: <20170213140428.54258-3-daniel.llorens@bluewin.ch> (raw)
In-Reply-To: <20170213140428.54258-1-daniel.llorens@bluewin.ch>

From: Daniel Llorens <daniel.llorens@bluewin.ch>

* benchmark-suite/benchmarks/uniform-vector-read.bm:
  Remove; uniform-vector-read! and uniform-vector-write were deprecated
  in 2.0 and are have been removed in 2.1.
* benchmark-suite/benchmarks/bytevector-io.bm: New benchmark.
* benchmark-suite/Makefile.am: Run the new benchmark.
---
 benchmark-suite/Makefile.am                        |  2 +-
 .../{uniform-vector-read.bm => bytevector-io.bm}   | 29 +++++++++++-----------
 2 files changed, 15 insertions(+), 16 deletions(-)
 rename benchmark-suite/benchmarks/{uniform-vector-read.bm => bytevector-io.bm} (64%)

diff --git a/benchmark-suite/Makefile.am b/benchmark-suite/Makefile.am
index 1222121..47bd036 100644
--- a/benchmark-suite/Makefile.am
+++ b/benchmark-suite/Makefile.am
@@ -1,5 +1,6 @@
 SCM_BENCHMARKS = benchmarks/0-reference.bm		\
 		 benchmarks/arithmetic.bm		\
+		 benchmarks/bytevector-io.bm	        \
 		 benchmarks/bytevectors.bm		\
 		 benchmarks/chars.bm			\
 		 benchmarks/continuations.bm		\
@@ -13,7 +14,6 @@ SCM_BENCHMARKS = benchmarks/0-reference.bm		\
 		 benchmarks/srfi-13.bm			\
 		 benchmarks/structs.bm			\
 		 benchmarks/subr.bm			\
-		 benchmarks/uniform-vector-read.bm	\
 		 benchmarks/vectors.bm			\
 		 benchmarks/vlists.bm			\
 		 benchmarks/write.bm			\
diff --git a/benchmark-suite/benchmarks/uniform-vector-read.bm b/benchmark-suite/benchmarks/bytevector-io.bm
similarity index 64%
rename from benchmark-suite/benchmarks/uniform-vector-read.bm
rename to benchmark-suite/benchmarks/bytevector-io.bm
index 01b7478..7ae7c0e 100644
--- a/benchmark-suite/benchmarks/uniform-vector-read.bm
+++ b/benchmark-suite/benchmarks/bytevector-io.bm
@@ -1,6 +1,6 @@
-;;; uniform-vector-read.bm --- Exercise binary I/O primitives.  -*- Scheme -*-
+;;; bytevector-io.bm --- Exercise bytevector I/O primitives.  -*- Scheme -*-
 ;;;
-;;; Copyright (C) 2008 Free Software Foundation, Inc.
+;;; Copyright (C) 2008, 2017 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
@@ -17,9 +17,10 @@
 ;;; not, write to the Free Software Foundation, Inc., 51 Franklin
 ;;; Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-(define-module (benchmarks uniform-vector-read)
+(define-module (benchmarks bytevector-io)
   :use-module (benchmark-suite lib)
-  :use-module (srfi srfi-4))
+  :use-module (rnrs io ports)
+  :use-module (rnrs bytevectors))
 
 (define file-name
   (tmpnam))
@@ -30,24 +31,22 @@
 (define buf
   (make-u8vector %buffer-size))
 
-(define str
-  (make-string %buffer-size))
-
 \f
-(with-benchmark-prefix "uniform-vector-read!"
+(with-benchmark-prefix "bytevector i/o"
 
-  (benchmark "uniform-vector-write" 4000
+  (benchmark "put-bytevector" 4000
     (let ((output (open-output-file file-name)))
-      (uniform-vector-write buf output)
+      (put-bytevector output buf)
       (close output)))
 
-  (benchmark "uniform-vector-read!" 20000
+  (benchmark "get-bytevector-n!" 20000
     (let ((input (open-input-file file-name)))
       (setvbuf input 'none)
-      (uniform-vector-read! buf input)
+      (get-bytevector-n! input buf 0 (bytevector-length buf))
       (close input)))
 
-  (benchmark "string port" 5000
-    (let ((input (open-input-string str)))
-      (uniform-vector-read! buf input)
+  (benchmark "get-bytevector-n" 20000
+    (let ((input (open-input-file file-name)))
+      (setvbuf input 'none)
+      (get-bytevector-n input (bytevector-length buf))
       (close input))))
-- 
2.10.1




  parent reply	other threads:[~2017-02-13 14:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 14:04 Better support for non-zero lower bound arrays daniel.llorens
2017-02-13 14:04 ` [PATCH 1/6] Remove unnecessary #include daniel.llorens
2017-02-13 14:04 ` daniel.llorens [this message]
2017-02-13 14:04 ` [PATCH 3/6] Remove documentation on uniform-vector-read!, uniform-vector-write daniel.llorens
2017-02-13 14:04 ` [PATCH 4/6] Fix sort, sort! for arrays with nonzero lower bound daniel.llorens
2017-02-13 14:04 ` [PATCH 5/6] Support non-zero lower bounds in array-slice-for-each daniel.llorens
2017-02-13 14:04 ` [PATCH 6/6] Fix bitvectors and non-zero lower bound arrays in truncated-print daniel.llorens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170213140428.54258-3-daniel.llorens@bluewin.ch \
    --to=daniel.llorens@bluewin.ch \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).