On 19May2022 19:50, Marco Sulla <marco.sulla.pyt...@gmail.com> wrote:
>On Wed, 18 May 2022 at 23:32, Cameron Simpson <c...@cskk.id.au> wrote:
>> You're measuring different things. timeit() tries hard to measure 
>> just
>> the code snippet you provide. It doesn't measure the startup cost of the
>> whole python interpreter. Try:
>>
>>     time python3 your-tail-prog.py /home/marco/lorem.txt
>
>Well, I'll try it, but it's not a bit unfair to compare Python startup with C?

Yes it is. But timeit goes the other way and only measures the code.  
Admittedly I'd expect a C tail to be pretty quick anyway. But... even a 
small C programme often has a surprising degree of startup these days, 
what with dynamicly linked libraries, locale lookups etc etc. Try:

    strace tail some-empty-file.txt

and see what goes on. If you're on slow hard drives what is cached in 
memory and what isn't can have a surprising effect.

Cheers,
Cameron Simpson <c...@cskk.id.au>
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to