Hello<div><br></div><div>First, thanks for your help on previous questions :-)</div><div><br></div><div>I have a NIF implementation that have a peculiar timing behavior (the NIF code is pretty simple, doing enif_get_tuple, enif_get_atom, enif_get_resource and some O(1) operations).</div><div><br></div><div>The median time is 39 us (microseconds)</div><div>15666/16079 calls take < 100 us</div><div>16049/16079 calls take < 1000 us</div><div>16052/16079 calls take < 10000 us</div><div>16067/16079 calls take < 100000 us</div><div><br></div><div>I'm running a list comprehension that gives me the time taken for each call:</div><div><br></div><div>[begin A = os:timestamp(), doit(), io:format("~w ", [now:time_diff(os:timestamp(), A)]) end || _ <- lists:seq(1, 16#10000)].</div><div><br></div><div>I'm running R16B on a 4 core VM.</div><div><br></div><div>Of course some lag due to process switching etc would be expected, but 12 of the 16k calls take more than 0.1 seconds to run. That seems way to much to me. (I get the same behavior when not doing the io:format/2 call).</div><div><br></div><div>Any clue why?</div><div><br></div><div>Thank you</div><div>/Fredrik</div>