As a Linux administrator, I wrote my scripts in Bash, TCL, and, less commonly, in Perl. Just out of curiosity, I tried to write something in mzscheme, but it turned out that the performance was much worse. I disabled the script by simply reading the 500 MB log file:
#lang scheme (require rnrs/programs-6) (call-with-input-file (vector-ref (current-command-line-arguments) 0) (lambda (in) (let loop ((line (read-line in))) (unless (eof-object? line) (loop (read-line in))))))
This simple process takes about 40 seconds. The same script adapted for Guile is executed after 10 seconds. TCL version runs for 5 seconds. The chicken circuit takes only 3.8 seconds, ten times less than the MZScheme:
#!/usr/bin/csi -script (call-with-input-file (list-ref (command-line-arguments) 0) (lambda (in) (let loop ((line (read-line in))) (if (not (eof-object? line)) (loop (read-line in))))))
What am I doing wrong? Are there any recommendations for writing faster MZScheme programs?
Some more tests:
minaev@minaev :~/1$ time ./t.tcl blog.log real 0m8.907s user 0m8.417s sys 0m0.468s Mon Oct 31 13:15:19 MSK 2011 minaev@minaev :~/1$ time ./t.scm blog.log
source share