Hello,
I maintain the Racket r7rs package, which as far as I know, has not
gotten much use. Recently, however, someone has put together a set of
R7RS benchmarks and run it against various Scheme implementations,
including Racket, using my r7rs-lib package. The benchmarks themselves
are here:
https://www.nexoid.at/tmp/scheme-benchmark-r7rs.html
I’ve been working to fix any areas in which Racket’s speed is negatively
impacted by the code I’ve written, and I’ve fixed a few small issues.
However, there are definitely a few areas where the performance problems
live outside of my code, and Sam recommended I bring up at least one of
them here.
Specifically, the following program is fairly slow:
#lang racket/base
(define (catport in out)
(let ((x (read-char in)))
(unless (eof-object? x)
(write-char x out)
(catport in out))))
(define (go input-file output-file)
(when (file-exists? output-file)
(delete-file output-file))
(call-with-input-file
input-file
(lambda (in)
(call-with-output-file
output-file
(lambda (out)
(catport in out))))))
It is a very simple cat implementation the benchmarks themselves invoke
it on a file about 4.5MB in size, and it takes about 15 seconds. This is
comparable with some other Scheme implementations, but it’s thoroughly
beaten by Bigloo, Chez, and Larceny, which are all in the 1-3 second
range. Replacing read-char and write-char with read-byte and write-byte
brings the time down to about 11 seconds, but it doesn’t change things
significantly. Is there any simple way this could be improved, or is the
time I’m getting just intrinsic to Racket’s implementation of I/O?
Alexis