[plt-scheme] port -> file/line/column ?
On Wed, 9 Oct 2002, Matthew Flatt wrote:
> The overhead is high for tasks that read large blocks from a file. For
> example, the `copy-port' operation in the following program takes twice
> as long when the fourth line is uncommented.
>
Actually, I'm about SSAX which is `read-char' based.
What would you say about `read-char' / `peek-char' overhead ?
> (require (lib "thread.ss"))
> (define s (open-output-string))
> (define p (open-input-file (find-system-path 'exec-file)))
> ; (port-count-lines! p)
> (time (copy-port p s))
>
> Arguably, the default could be to count lines and columns, instead of
> not counting. But after tuning the I/O paths so carefully, I'm
> reluctant to slow them down by default.
>
Well, what's about a "global" customization of this behaviour?
Say,
(ports-count-lines #t)
for compatibility and convenience
(ports-count-lines #f)
for large blocks IO speed?
Probably, in conjunction with
(port-count-lines port count?)
for precise customization...
> > 2. Any ideas about file name?
>
> I've just changed `object-name' to return a string for input ports. For
> a file input port, the string is the absolute file path.
This makes me happy. Thank you a lot!
Best regards,
Kirill.