[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, master, updated. release_1-9-14-104-gd
From: |
Ludovic Courtès |
Subject: |
[Guile-commits] GNU Guile branch, master, updated. release_1-9-14-104-gd9f24bc |
Date: |
Wed, 26 Jan 2011 22:03:26 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=d9f24bc91723182522c66157fc805f6ad2d4c4c6
The branch, master has been updated
via d9f24bc91723182522c66157fc805f6ad2d4c4c6 (commit)
via e578faea202a4e6eeb32e81e489b59119a2e02a0 (commit)
from 2183d66e134a5512b5b4993cb5255c1c1308dc47 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d9f24bc91723182522c66157fc805f6ad2d4c4c6
Author: Ludovic Courtès <address@hidden>
Date: Wed Jan 26 23:02:41 2011 +0100
Add a `read-line' benchmark.
* benchmark-suite/benchmarks/ports.bm ("rdelim"): New benchmark prefix.
commit e578faea202a4e6eeb32e81e489b59119a2e02a0
Author: Ludovic Courtès <address@hidden>
Date: Wed Jan 26 22:59:45 2011 +0100
Tweak `read-line'.
* libguile/rdelim.c (LINE_BUFFER_SIZE): Set to 1 KiB instead of 4 KiB.
(scm_read_line): Initialize STRING to #f so we actually use the fast
path.
-----------------------------------------------------------------------
Summary of changes:
benchmark-suite/benchmarks/ports.bm | 23 ++++++++++++++++++++++-
libguile/rdelim.c | 9 +++++----
2 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/benchmark-suite/benchmarks/ports.bm
b/benchmark-suite/benchmarks/ports.bm
index 917a7dd..166cfa5 100644
--- a/benchmark-suite/benchmarks/ports.bm
+++ b/benchmark-suite/benchmarks/ports.bm
@@ -1,6 +1,6 @@
;;; ports.bm --- Port I/O. -*- mode: scheme; coding: utf-8; -*-
;;;
-;;; Copyright (C) 2010 Free Software Foundation, Inc.
+;;; Copyright (C) 2010, 2011 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
@@ -18,6 +18,7 @@
;;; Street, Fifth Floor, Boston, MA 02110-1301 USA
(define-module (benchmarks ports)
+ #:use-module (ice-9 rdelim)
#:use-module (benchmark-suite lib))
(define %latin1-port
@@ -65,3 +66,23 @@
(benchmark "utf-8 port, Korean character" 10000000
(char-ready? %utf8/wide-port)))
+
+
+(with-benchmark-prefix "rdelim"
+
+ (let-syntax ((sequence (lambda (s)
+ ;; Create a sequence `(begin EXPR ...)' with
+ ;; COUNT occurrences of EXPR.
+ (syntax-case s ()
+ ((_ expr count)
+ (number? (syntax->datum #'count))
+ (cons #'begin
+ (make-list
+ (syntax->datum #'count)
+ #'expr)))))))
+ (let ((str (string-concatenate
+ (make-list 1000 "one line\n"))))
+ (benchmark "read-line" 1000
+ (let ((port (with-fluids ((%default-port-encoding "UTF-8"))
+ (open-input-string str))))
+ (sequence (read-line port) 1000))))))
diff --git a/libguile/rdelim.c b/libguile/rdelim.c
index 0fa0b8f..760aa47 100644
--- a/libguile/rdelim.c
+++ b/libguile/rdelim.c
@@ -122,7 +122,7 @@ SCM_DEFINE (scm_read_line, "%read-line", 0, 1, 0,
{
/* Threshold under which the only allocation performed is that of the
resulting string and pair. */
-#define LINE_BUFFER_SIZE 1024
+#define LINE_BUFFER_SIZE 256
SCM line, strings, result;
scm_t_wchar buf[LINE_BUFFER_SIZE], delim;
@@ -135,11 +135,11 @@ SCM_DEFINE (scm_read_line, "%read-line", 0, 1, 0,
index = 0;
delim = 0;
- strings = SCM_EOL;
+ strings = SCM_BOOL_F;
do
{
- if (index >= sizeof (buf))
+ if (SCM_UNLIKELY (index >= sizeof (buf)))
{
/* The line is getting longer than BUF so store its current
contents in STRINGS. */
@@ -164,7 +164,8 @@ SCM_DEFINE (scm_read_line, "%read-line", 0, 1, 0,
}
while (delim == 0);
- if (scm_is_false (strings))
+ if (SCM_LIKELY (scm_is_false (strings)))
+ /* The fast path. */
line = scm_from_utf32_stringn (buf, index);
else
{
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, master, updated. release_1-9-14-104-gd9f24bc,
Ludovic Courtès <=