The attached patch should be a little bit faster than the old version since we don't do redundant type checks and call the ports write-string method directly. Thanks to felix for the suggestion.
Kind regards, Christian -- Who can (make) the muddy water (clear)? Let it be still, and it will gradually become clear. Who can secure the condition of rest? Let movement go on, and the condition of rest will gradually arise. -- Lao Tse.
>From d34f1fa1ea8248725e5441c97e2a5ab20aa200f1 Mon Sep 17 00:00:00 2001 From: Christian Kellermann <ck...@pestilenz.org> Date: Sun, 25 Sep 2011 11:58:02 +0200 Subject: [PATCH] replace write-line calls to display with internal procedures. --- extras.scm | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/extras.scm b/extras.scm index 151ca95..a5aad5f 100644 --- a/extras.scm +++ b/extras.scm @@ -134,13 +134,17 @@ (define write-line (lambda (str . port) - (let ((p (if (##core#inline "C_eqp" port '()) - ##sys#standard-output - (##sys#slot port 0) ) ) ) - (##sys#check-port p 'write-line) + (let* ((p (if (##core#inline "C_eqp" port '()) + ##sys#standard-output + (##sys#slot port 0) ) ) + (write-string (and + (##sys#check-port p 'write-line) + (##sys#slot (##sys#slot p 2) 3)))) + (unless write-string + (##sys#error 'write-line "Not an output port: " port)) (##sys#check-string str 'write-line) - (display str p) - (newline p) ) ) ) + (write-string p str) + (##sys#write-char-0 #\newline p)))) ;;; Extended I/O -- 1.7.3.5
_______________________________________________ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers