quilt-dev
[Top][All Lists]
Advanced

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

Re: [Quilt-dev] [patch 3/8] tac is not portable


From: Gary V. Vaughan
Subject: Re: [Quilt-dev] [patch 3/8] tac is not portable
Date: Thu, 15 Sep 2005 16:03:58 +0100
User-agent: Mozilla Thunderbird 1.0 (X11/20050305)

Jean Delvare wrote:
Hi Gary,

Salut!

This is kinda moot now that the tac dependency has gone, but I see that
I made a paste error that I wanted to correct, and neglected to explain
why I tested as I did.  Plus, when tested correctly the result is more
than a little surprising:

For a file that has maybe 50 lines worst case

50 lines worst case? *You* must be kidding me now. My series file is
frequently nearing 100 patches, and Andrew Morton's is more like 500.

Okay, my bad.  Lets make it 500 1ines then.  (That will actually
make the difference between the two even smaller btw, as the startup
time of perl will be less significant as the processing time increases).

$ head -n 50 /var/log/httpd/access_log > input
$ time sh -c "cat input | perl -e 'print reverse <>'

that should have been:

$ time sh -c "cat input | perl -e 'print reverse <>'"

real    0m0.025s
user    0m0.005s
sys     0m0.017s

$ time sh -c "head -n 50 /var/log/httpd/access_log | gtac"

that should have been:

$ time sh -c "cat input | gtac"

real    0m0.026s
user    0m0.005s
sys     0m0.017s

You're not comparing the same test case, and you are bringing "sh"
into the picture needlessly.

I started with "head ... | perl ..." and realised that I didn't want
to measure the time spent in head.  So I reran the tests by catting
a file directly.  The timings I show are still correct, but I didn't
correct the shell lines I'd pasted earlier.

Please compare:

  time head -n 500 <largefile> | perl -e 'print reverse <>'

with:

  time head -n 500 <largefile> | gtac

This will be a more valid test.

Ofcourse this just times 'head', and will be identical for both
test cases ;-)  That's why I introduced the 'sh -c', both the
sh and cat startup times should be constant, so the timings will
then be proportional to the variable part of the pipeline (perl
vs tac).

Actually, a better test would've been:

$ wc -l input
      500 input
$ time perl -e 'print reverse <>' < input
...
real    0m0.015s
user    0m0.004s
sys     0m0.009s
$ time gtac < input
...
real    0m0.021s
user    0m0.005s
sys     0m0.014s

Interestingly... perl is faster! :-D  Try it yourself. (Don't forget to
run each one several times until you get three or four similar results).

This is hardly a reason not to consider the speed difference, providing
we can evaluate it. My tests this morning, on a 650 MHz Pentium III, was
about 0.070s against 0.025s for tac. This makes a difference. You may
object that 0.045s isn't really important, but this is added by
changing only one part of the whole command.

Odd!  If you were just timing head they should've been identical.  Did
you run perl first (to load the disk cache i.e slow) and then tac right
after (with the cache already loaded i.e fast)?.

The compatibility issues we
are trying to address these days are likely to require us to change more
commands. If we do not care about performance, the cumulated changes are
likely to make quilt slower than it was, and I would like to avoid that.

ACK.

Please keep in mind that not everyone uses fast machines. My laptop runs
at 650 MHz, my workstation (day job) runs at 500 MHz. I want quilt to be
reaonably fast on these systems.

ACK.

Another point to consider is that quilt is currently usable without perl.
No major command needs it as far as I can see. Some users may find it
valuable. Bringing in more perl into quilt is even questionable, as
quilt is supposed to be shell-based.

Big ACK.  My dislike of perl is well known!

If you want something totally portable, perl is obviously the way to go,
> but you better rewrite quilt entierly in perl then.

Python maybe. But I actually like shell (which is lucky since I maintain libtool), and quilt is quite useable as is... pending
some portability nits that seem to being fixed anyway.

Cheers,
        Gary.
--
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]