On 11/13/2012 05:35 PM, Richard W.M. Jones wrote:
On Tue, Nov 13, 2012 at 02:41:44PM +0000, Pádraig Brady wrote:
>
> It could be argued that python is more suited to long lived programs:
>
> $ time /bin/true
> real 0m0.002s
Hmmm:
$ echo '' > true.ml
$ ocamlopt.opt true.ml -o true
$ time ./true
real 0m0.002s
user 0m0.000s
sys 0m0.001s
$ time /bin/true
real 0m0.001s
user 0m0.000s
sys 0m0.001s
This seems about right to me: Both ocamlopt & gcc generate native
x86-64 programs, but there's a small amount of overhead in the OCaml
binary (initializing the minor heap of the GC).
Just for fun, let's see who is the worst.
$ cat >JavaTrue.java
public class JavaTrue {
public static void main(String[] args) {
System.exit(0);
}
}
$ javac JavaTrue.java
$ time java -cp . JavaTrue
real 0m0.071s
user 0m0.037s
sys 0m0.035s
Hmmm. Slow and with a lot of sys...
Let's try compiling it to native.
$ gcj -o JavaTrue JavaTrue.java --main=JavaTrue
$ time ./JavaTrue
real 0m0.026s
user 0m0.016s
sys 0m0.010s
Good improvement, but still quite slow.
(OT: what a pity gcj is abandoned... great project)
--
Roberto Ragusa mail at robertoragusa.it