[erlang-questions] native

Kostis Sagonas kostis@REDACTED
Mon Sep 10 17:02:52 CEST 2012


On 09/10/2012 04:35 PM, Jesper Louis Andersen wrote:
> On Sep 10, 2012, at 4:06 PM, Kostis Sagonas<kostis@REDACTED>  wrote:
>
>>
>> I do not have a Mac, but on my i7-desktop, using vanilla R15B01 configured with --enable-native-libs (I do not think this matters here) I get:
>>
>
> Perhaps you are really not measuring the CPU at full speed because it only changed frequency when there is something to do. A guess is that the CPU speed should be locked at a certain rate for this test to be fair.
>
> Or at least that is a shot in the dark, you may utilize.

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...

Kostis



More information about the erlang-questions mailing list