[erlang-questions] erlang:now() vs os:timestamp()

Magnus Henoch <>
Wed Apr 3 18:57:54 CEST 2013


"Manuel A. Rubio \"Bombadil\"" <> writes:

> Hi,
>
> I saw a keynote[1] from Rick Reed (WhatsApp) and he said: "Prefer
> os:timestamp to erlang:now"... I did a benchmark to test it[2], and
> get the following results:
>
> os:timestamp =  1.44  1.38  1.38
> erlang:now   =  1.01  1.00  1.00
>
> I know that he says "prefer" and not "better"... but the benchmark
> says that he should be say the opposite :-P
>
> What do you think?

I added -mode(compile) to your script:

https://gist.github.com/legoscia/5303050

and now I get completely different results:

os:timestamp =  0.36  0.15  0.17
erlang:now   =  1.00  1.00  1.00


Regards,
Magnus


More information about the erlang-questions mailing list