Timer:tc
Mats Cronqvist
mats.cronqvist@REDACTED
Mon Aug 28 10:21:30 CEST 2006
Matthew Sackman wrote:
> On Mon, Aug 28, 2006 at 11:52:26AM +0800, lang er wrote:
>> So why:
>> 2> timer:tc(count_chars,file, ["gc.txt"]).
>> {375,116}
>
> Now file is cached in RAM by OS so access is much faster.
>
>> 3> T1 = erlang:now(),
>> 3> count_chars:file("gc.txt"),
>> 3> T2 = erlang:now(),
>> 3> Time = timer:now_diff(T2, T1).
>> 464
>
2 is compiled, 3 is run in the evaluator.
btw, the erlang:apply in timer:tc is insignificant compared to 400 microseconds.
mats
More information about the erlang-questions
mailing list