[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Chicken vs Perl
From: |
Sascha Ziemann |
Subject: |
Re: [Chicken-users] Chicken vs Perl |
Date: |
Tue, 20 Sep 2011 17:01:52 +0200 |
2011/9/20 Daishi Kato <address@hidden>:
>
> 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.
- Re: [Chicken-users] Chicken vs Perl, (continued)