2011/9/20 Daishi Kato <dai...@axlight.com>: > > My guess is that read-line is slower than <> in perl. > (I think <> is so optimized in perl.)
Yes this is one reason. I tried this: $ dd if=/dev/zero bs=1M count=100 | od -xv | cat > /dev/null 100+0 records in 100+0 records out 104857600 bytes (105 MB) copied, 7.69538 s, 13.6 MB/s $ dd if=/dev/zero bs=1M count=100 | od -xv | perl -pe 'print $_;' > /dev/null 100+0 records in 100+0 records out 104857600 bytes (105 MB) copied, 8.1591 s, 12.9 MB/s $ dd if=/dev/zero bs=1M count=100 | od -xv | cat.scm > /dev/null 100+0 records in 100+0 records out 104857600 bytes (105 MB) copied, 36.9156 s, 2.8 MB/s With cat.scm being this: #! /usr/local/bin/csi -s (let next-line ((line (read-line))) (if (not (eof-object? line)) (begin (printf "~a\n" line) (next-line (read-line))))) But it is only about 5 times slower and not 30 times like my original program. _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users