I didn't notice that read-bytevector should return #<eof>
if no bytes are read. Here are changes to r7rs.scm that
make your code work I think (but I doubt it's faster):
127c127,129
< (if (= i start) #<eof> i))
---
(if (< i lim)
(copy (subvector bv 0 i))
bv))
130,138c132
< (define* (read-bytevector k port)
< (let* ((buf (make-byte-vector k))
< (bytes (read-bytevector! buf port)))
< (if (eof-object? bytes)
< bytes
< (if (= k bytes)
< buf
< (subvector buf 0 bytes)))))
<
---
(define* (read-bytevector k port) (read-bytevector! (make-byte-vector
k) port))
A small thing: I'd write your loop
(do ((buffer (read-bytevector buffer-size source) (read-bytevector
buffer-size source)))
Starting with (bytevector) looks pointless.
s7test.scm has a version of copy-file (line 100143) that uses
libc functions and which I would expect to be fast.
_______________________________________________
Cmdist mailing list
[email protected]
https://cm-mail.stanford.edu/mailman/listinfo/cmdist