[plt-scheme] String port prodecure comparison between R6RS and SRFI

From: Joo (tilde at naver.com)
Date: Thu Jun 4 08:29:31 EDT 2009

There are too much peformance differences between srfi-6 and R6RS string port
library in comparison with other R6RS conforming implementation.
I'd like to know whether they result from R6RS library itself or Mzscheme.
 
Welcome to MzScheme v4.2 [3m], Copyright (c) 2004-2009 PLT Scheme Inc.
> (define-syntax dotimes
 (syntax-rules ()
 ((dotimes (i count) b d ...)
 (do ((i 0 (+ i 1)))
 ((= i count))
 b d ...))
 ((dotimes count b d ...)
 (dotimes (i count) b d ...))))
> (time (dotimes 1000000 (get-output-string (let ((port (open-output-string))) (write "abc" port) port))))
cpu time: 1343 real time: 1343 gc time: 126
> (require rnrs)
> (time (dotimes 1000000 (call-with-string-output-port (lambda (port) (write "abc" port) port))))
cpu time: 21109 real time: 21109 gc time: 4519
> (time (dotimes 1000000 (call-with-values (lambda () (open-string-output-port)) (lambda (port proc) (write "abc" port) proc))))
cpu time: 22625 real time: 22625 gc time: 7346
> (time (dotimes 1000000 (get-output-string (let ((port (open-output-string))) (write "abc" port) port))))
put-datum: expected argument of type ; given #
Ypsilon 0.9.6-update3 Copyright (c) 2008 Y.Fujita, LittleWing Company Limited.
> (import (time))
> (import (srfi srfi-6))
> (time (dotimes 1000000 (get-output-string (let ((port (open-output-string))) (write "abc" port) port))))
;; 2.375 real 4.28125 user 0.015625 sys
> (time (dotimes 1000000 (call-with-string-output-port (lambda (port) (write "abc" port) port))))
;; 3.656252 real 5.8125 user 0.03125 sys
> (time (dotimes 1000000 (call-with-values (lambda () (open-string-output-port)) (lambda (port proc) (write "abc" port) proc))))
;; 2.546875 real 4.4375 user 0.0625 sys
--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090604/34890684/attachment.html>

Posted on the users mailing list.