[erlang-questions] Pointless md5 Problem

Matt Stancliff sysop@REDACTED
Thu May 7 07:18:39 CEST 2009


On May 6, 2009, at 9:50 PM, Matthias Lang wrote:

>>   erlang:md5/1 is pure erlang.
>
> No it's not.

   Doh.

> Same for older versions of Erlang (R12, R11, ...). Why do you think it
> is pure Erlang?

   Oops.  Looks like I meant built in and not pure erlang.  erlang:md5  
happily resides in:
erts/emulator/beam/erl_md5.c

Anyway, my point was the crypto version is faster.  Looks to be over  
five times faster:
(genges@REDACTED)190> C = fun(Module, Data) -> {Time, _} =  
timer:tc(Module, md5, [Data]), Time end.
#Fun<erl_eval.12.113037538>
(genges@REDACTED)192> N = 4000.
4000
(genges@REDACTED)193> lists:sum([C(crypto, Data) || _ <- lists:seq(1,  
N)])/N.
12041.3115
(genges@REDACTED)194> lists:sum([C(erlang, Data) || _ <- lists:seq(1,  
N)])/N.
63903.586
(genges@REDACTED)195> 63903.586/12041.3115.
5.307028723573841


Sorry for the confusion,

-Matt
-- 
Matt Stancliff                    San Jose, CA
AIM: seijimr              iPhone: 678-591-9337
"The best way to predict the future is to invent it." --Alan Kay




More information about the erlang-questions mailing list