[erlang-questions] native

Rich Neswold <>
Mon Sep 10 16:53:43 CEST 2012


On Mon, Sep 10, 2012 at 10:02 AM, Kostis Sagonas <> wrote:
> Does not appear to be the case:
>
> Eshell V5.9.1  (abort with ^G)
> 1> Bin =  << <<X>> || X <- lists:seq(1, 1024*1024) >>.
> <<1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,
>   22,23,24,25,26,27,28,29,...>>
> 2> c(md5).
> {ok,md5}
> 3> [begin {T, _} = timer:tc(md5, md5, [Bin]), T end || _ <-
> lists:seq(1,10)].
> [2069001,2036776,2043727,2042717,2041177,2053276,2037912,
>  2050634,2045248,2044197]
> 4> c(md5, [native]).
> {ok,md5}
> 5> [begin {T, _} = timer:tc(md5, md5, [Bin]), T end || _ <-
> lists:seq(1,10)].
> [1920904,1884088,1883944,1888162,1886673,1889737,1878162,
>  1883588,1892836,1879735]
>
> Not much variance in the results, but clearly in at least the last three
> runs of the bench the CPU should be at a higher frequency...

What about:

c(md5, [native, inline]).

-- 
Rich



More information about the erlang-questions mailing list