increased IO block-size from 4K to 16K.

This commit is contained in:
Abdulaziz Ghuloum 2008-01-19 14:51:14 -05:00
parent 323d1037ea
commit 497d2ea8ed
2 changed files with 19 additions and 10 deletions

View File

@ -570,7 +570,8 @@
(die 'port-transcoder "not a port" p))) (die 'port-transcoder "not a port" p)))
(define ($port-closed? p) (define ($port-closed? p)
(not (fxzero? (fxand ($port-attrs p) closed-port-tag)))) (import UNSAFE)
(not (fx= (fxand ($port-attrs p) closed-port-tag) 0)))
(define (port-closed? p) (define (port-closed? p)
(if (port? p) (if (port? p)
@ -607,6 +608,7 @@
(case-lambda (case-lambda
[() (flush-output-port (*the-output-port*))] [() (flush-output-port (*the-output-port*))]
[(p) [(p)
(import UNSAFE)
(unless (output-port? p) (unless (output-port? p)
(die 'flush-output-port "not an output port" p)) (die 'flush-output-port "not an output port" p))
(when ($port-closed? p) (when ($port-closed? p)
@ -667,7 +669,7 @@
(when ($port-closed? p) (die who "port is closed" p)) (when ($port-closed? p) (die who "port is closed" p))
(let ([bv ($port-buffer p)] [i ($port-index p)] [j ($port-size p)]) (let ([bv ($port-buffer p)] [i ($port-index p)] [j ($port-size p)])
(let ([c0 (fx- j i)]) (let ([c0 (fx- j i)])
(bytevector-copy! bv i bv 0 c0) (unless (fx= c0 0) (bytevector-copy! bv i bv 0 c0))
(let ([pos ($port-position p)]) (let ([pos ($port-position p)])
(when pos (when pos
($set-port-position! p (fx+ pos i)))) ($set-port-position! p (fx+ pos i))))
@ -1186,10 +1188,13 @@
(make-message-condition msg) (make-message-condition msg)
(make-i/o-filename-error id)))))) (make-i/o-filename-error id))))))
(define block-size 4096) ;(define block-size 4096)
;(define block-size (* 16 4096)) ;(define block-size (* 4 4096))
(define input-file-buffer-size (+ block-size 128)) (define input-block-size (* 4 4096))
(define output-file-buffer-size block-size) (define output-block-size (* 4 4096))
(define input-file-buffer-size (+ input-block-size 128))
(define output-file-buffer-size output-block-size)
(define (fh->input-port fd id size transcoder close) (define (fh->input-port fd id size transcoder close)
(letrec ([port (letrec ([port
@ -1203,8 +1208,8 @@
(import UNSAFE) (import UNSAFE)
(let ([bytes (let ([bytes
(foreign-call "ikrt_read_fd" fd bv idx (foreign-call "ikrt_read_fd" fd bv idx
(if (fx< block-size cnt) (if (fx< input-block-size cnt)
block-size input-block-size
cnt))]) cnt))])
(cond (cond
[(fx>= bytes 0) bytes] [(fx>= bytes 0) bytes]
@ -1234,9 +1239,13 @@
#f #f
(letrec ([refill (letrec ([refill
(lambda (bv idx cnt) (lambda (bv idx cnt)
(import UNSAFE)
(let ([bytes (let ([bytes
(foreign-call "ikrt_write_fd" fd bv idx (foreign-call "ikrt_write_fd" fd bv idx
(fxmin block-size cnt))]) (if (fx< output-block-size cnt)
output-block-size
cnt))])
(cond (cond
[(fx>= bytes 0) bytes] [(fx>= bytes 0) bytes]
[(fx= bytes EAGAIN-error-code) [(fx= bytes EAGAIN-error-code)

View File

@ -1 +1 @@
1343 1346