Re: [PATCH] Use perl instead of tac

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hallo Randal,

Randal L. Schwartz <merlyn@xxxxxxxxxxxxxx> wrote:
>>>>>> "Jörg" == Jörg Sommer <joerg@xxxxxxxxxxxx> writes:
>
> Jörg> What about using a shell function and a *big* variable or an intermediate
> Jörg> file?
>
> What makes you think that's any more faster or efficient than calling Perl
> at this point?

Nothing. My intention was not the speed, but the dependency on Perl. But
your are right. Except from the point that my suggestion is broken, it's
*much* slower:

% time dash -c 'while IFS= read -r line; do rev="$line
$rev"; done; printf "%s" "$rev"' < gitk-git/gitk-wish DN
dash -c  < gitk-git/gitk-wish > /dev/null 2> /dev/null  17,89s user 2,68s system 96% cpu 21,352 total

% time tac < gitk-git/gitk-wish DN
tac < gitk-git/gitk-wish > /dev/null 2> /dev/null  0,01s user 0,01s system 91% cpu 0,017 total

% time perl -e 'print reverse <>' < gitk-git/gitk-wish DN
perl -e 'print reverse <>' < gitk-git/gitk-wish > /dev/null 2> /dev/null  0,07s user 0,01s system 59% cpu 0,141 total

But I doubt this hurts, because we don't have such a big input.

% wc -l git.c
390 git.c

% time dash -c 'while IFS= read -r line; do rev="$line
$rev"; done; printf "%s" "$rev"' < git.c DN
dash -c  < git.c > /dev/null 2> /dev/null  0,04s user 0,04s system 62% cpu 0,115 total

And what about something like this: 'tac || rev || perl …'

Bye, Jörg.
-- 
Was der Bauer nicht kennt, das frisst er nicht. Würde der Städter kennen,
was er frisst, er würde umgehend Bauer werden.
                                                       Oliver Hassencamp
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux