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

Manuel A. Rubio "Bombadil" <>
Wed Apr 3 19:07:31 CEST 2013


good point! I don't know about -mode(compile), thanks Magnus.

El 2013-04-03 18:57, Magnus Henoch escribió:
> "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