Big difference between runtime and wall_clock time

Kaiduan Xie <>
Wed Jan 20 22:30:23 CET 2010


Hi,

I am surprised by the big difference between run time and wall_clock
time. The following result shows the performance to parse SDP (Session
Description Protocol).

:~/learn-erlang$ erl
Erlang R13B03 (erts-5.7.4) [source] [rq:1] [async-threads:0] [hipe]
[kernel-poll:false]

Eshell V5.7.4  (abort with ^G)
1> sdp:sdp_parse_performance(100000).
SDP parse time: 8.5/56.92 micro-seconds
ok
2>

sdp_parse_performance(N) ->
    statistics(runtime),
    statistics(wall_clock),
    sdp_performance_test(N),
    {_, Time1} = statistics(runtime),
    {_, Time2} = statistics(wall_clock),
    U1 = Time1 * 1000 /N,
    U2 = Time2 * 1000 /N,
    io:format("SDP parse time: ~p/~p micro-seconds~n", [U1, U2]),
    ok.

sdp_performance_test(0) ->
    ok;
sdp_performance_test(N) ->
    parse_sdp_test(),
    sdp_performance_test(N-1).

How to explain this?

Thanks,

kaiduan


More information about the erlang-questions mailing list