On Feb 16, 2013, at 8:54, Peter Bex <[email protected]> wrote: > Just removing the port position bookkeeping altogether is better, I > think. I haven't done any benchmarks but Chicken's notoriously awful > I/O performance might partially be due to the port position bookkeeping.
I seriously doubt that; it's more likely all the indirection (and Scheme code) that happens for each character when you call read-char. read-string and read-line are not subject to this as they read chunks at a time in C. (And now that read-line reads into a static buffer it is very fast, not quite at Perl speed.) It is worth a shot to bench it though just to prove it. Note that custom ports don't expose all functionality (like read-line) and so they will be abysmally slow unless you implement one using the non-public API, and even then, the underlying code like read-string should still be written in C instead of repeatedly calling read-char, or performance will be completely unacceptable. And maintaining this nearly duplicate code would be very annoying. In my opinion a better solution would be to have the compiler figure out when it is dealing with a file port etc. and inline the code to read-char (e.g. getc) based on the port type. It seems like this should be doable in the flow analysis pass, but I don't know for sure. Jim _______________________________________________ Chicken-hackers mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-hackers
