(native-module io-native "sisc.modules.io.IO$Index")
(import string-io)
(define s (make-string 10000 #\a))
(define (read-test1)
(call-with-input-string s
(lambda (port)
(let loop () (or (eof-object? (read-char port)) (loop))))))
(define (read-test2)
(import* gio/filtergenerics :in)
(call-with-input-string s
(lambda (port)
(set! port (:in port))
(let loop () (or (eof-object? (read-char port)) (loop))))))
(define (read-test3)
(import* gio/filtergenerics :in)
(import* io-native read-char)
(call-with-input-string s
(lambda (port)
(set! port (:in port))
(let loop () (or (eof-object? (read-char port)) (loop))))))
(time (read-test1)) ;;1168 ms
(time (read-test2)) ;; 454 ms
(time (read-test3)) ;; 53 ms
We need to do something about this!
One possibility is to allow people to break the gio abstraction along
the lines of read-test2. We can make that case perform nearly as fast as
read-test3 (my tests put the figure at 102ms) if we change the
implementation of read-char to check whether the port is a
native-input-port and if so call native-read-char.
Matthias.
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
|