[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:
#!/bin/bash
run=$*
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 run.sh and then call it on the various hello worlds:
$ ./run.sh bash hello.sh
median 0.005
$ ./run.sh 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
run.sh 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.
Tobia
- [Chicken-users] Hello World execution time, Tobia Conforto, 2011/03/13
- Re: [Chicken-users] Hello World execution time, John Cowan, 2011/03/13
- [Chicken-users] Re: Hello World execution time, John J Foerch, 2011/03/13
- Re: [Chicken-users] Hello World execution time, Daniel Aquino, 2011/03/13
- Re: [Chicken-users] Hello World execution time, Daniel Aquino, 2011/03/13
- Re: [Chicken-users] Hello World execution time, Bobby Powers, 2011/03/14
- Re: [Chicken-users] Hello World execution time,
Tobia Conforto <=
- Re: [Chicken-users] Hello World execution time, Tobia Conforto, 2011/03/14
- Re: [Chicken-users] Hello World execution time, Daniel Aquino, 2011/03/14
- Re: [Chicken-users] Hello World execution time, Tobia Conforto, 2011/03/14