[Top][All Lists]

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

Re: [Chicken-users] Hello World execution time

From: Tobia Conforto
Subject: Re: [Chicken-users] Hello World execution time
Date: Mon, 14 Mar 2011 19:54:23 +0100

John Cowan:
> It's astonishing that bash is faster than anything but C.

Astonishing indeed. The whole thing confirmed my hunch that Bash,
Chicken, and C provide a complete toolset to tackle 99.9% of
programming needs.

Bobby Powers :
> I got similar, but slightly different results

Maybe it depends on the way we are measuring things, maybe on hardware
or OS. Try using my bash script:



for ((i = 0; i < 10; ++i)); do
        time $run
        sleep .1
done &>/dev/null

for ((i = 0; i < 101; ++i)); do
        time $run
        sleep .1
done 2>&1 >/dev/null |
        sed -nE $'s/^real\t0m(.*)s$/\\1/p' |
        sort -n |
        sed -n '52s/^/median /p'

You can save it as and then call it on the various hello worlds:

$ ./ bash
median 0.005
$ ./ mono hello.exe
median 0.068

If you repeat each one a couple times, you should get the same result,
ie. 101 runs gave me an absolute error < 1ms. So unless I've made some
bad mistake, the only way to get better precision would be to code in some other language (so that it doesn't spawn sleep, sed,
and sort), to shut off all system daemons and cron, and to compute
mean and stddev. But frankly I couldn't be bothered :-)

Now I'll try and add haskell as requested.


reply via email to

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