Re: [Chicken-hackers] [PATCH] replace write-line calls to display with internal procedures.
From: Christian Kellermann ck...@pestilenz.org Subject: [Chicken-hackers] [PATCH] replace write-line calls to display with internal procedures. Date: Sun, 25 Sep 2011 19:45:23 +0200 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. Thanks for taking care of this issue, Christian! Two more suggestions: - use ##sys#check-port* to make sure the port is open - use ##sys#check-port-mode to do the direction check cheers, felix ___ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers
Re: [Chicken-hackers] [PATCH] replace write-line calls to display with internal procedures.
* felix winkelmann fe...@call-with-current-continuation.org [110926 08:45]: From: Christian Kellermann ck...@pestilenz.org Subject: [Chicken-hackers] [PATCH] replace write-line calls to display with internal procedures. Date: Sun, 25 Sep 2011 19:45:23 +0200 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. Thanks for taking care of this issue, Christian! Two more suggestions: - use ##sys#check-port* to make sure the port is open - use ##sys#check-port-mode to do the direction check Ah, those are convenient. I have attached an updated version of the patch. Thanks! 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 ca7811daf4951c93dcd60cc559197602dcb27f66 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 | 15 +-- 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/extras.scm b/extras.scm index bb9e434..e2bcf76 100644 --- a/extras.scm +++ b/extras.scm @@ -134,13 +134,16 @@ (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#check-port-mode p #f 'write-line) + (##sys#slot (##sys#slot p 2) 3 (##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.4.1 ___ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers
Re: [Chicken-hackers] [PATCH] replace write-line calls to display with internal procedures.
* Christian Kellermann ck...@pestilenz.org [110926 10:01]: Ignore this. I suck. Let me fetch some coffee and redo it properly. That should work better. -- 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 2c7581199b05019f4418cd31ec147a3d8cc2a4e1 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 | 13 +++-- 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/extras.scm b/extras.scm index bb9e434..3be95cc 100644 --- a/extras.scm +++ b/extras.scm @@ -134,13 +134,14 @@ (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) ) )) + (##sys#check-port* p 'write-line) + (##sys#check-port-mode p #f 'write-line) (##sys#check-string str 'write-line) - (display str p) - (newline p) ) ) ) + ((##sys#slot (##sys#slot p 2) 3) p str) ; write-string method + (##sys#write-char-0 #\newline p ;;; Extended I/O -- 1.7.4.1 ___ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers