<div dir="ltr">I have done a lot of measurements in my life and initially it was "easy", no caches, virtual memory, or frequency scaling. But even then You did a measurement of X and got a result. Then You thought a little about it and realized that You had actually measured Y. So You modified the test and ran it again and got a new result, that You soon realized was for Z. Repeat forever.<div><br></div><div>I gave up on these activities a few years ago when I found that the response times decreased with increased load. Because of frequency scaling.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 16, 2015 at 3:27 PM, Pierre Fenoll <span dir="ltr"><<a href="mailto:pierrefenoll@gmail.com" target="_blank">pierrefenoll@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On a side note I would be happy if we had a way to add a documentation clause that advertises the complexity of the documented function.<br>
<br>
Maybe the complexity can even be computed automatically.<br>
<br>
And combining cost of atomic actions could give an idea of the cost of these complexities constants.<br>
<div class="HOEnZb"><div class="h5"><br>
> On 16 Sep 2015, at 13:09, Joe Armstrong <<a href="mailto:erlang@gmail.com">erlang@gmail.com</a>> wrote:<br>
><br>
>> On Wed, Sep 16, 2015 at 9:03 PM, Theepan <<a href="mailto:vasdeveloper@gmail.com">vasdeveloper@gmail.com</a>> wrote:<br>
>> I have never heard of such a cost model for Erlang’s basic operations, but<br>
>> most of the time I profiled the code to find out the cost of a code-segment,<br>
>> using tools and functions provided by Erlang/OTP. The Erlang documents list<br>
>> do-s and don’t-s, and from the engineering school I know good programing<br>
>> practices. And most of the time I use common sense of how to write a good<br>
>> piece of code. This is my story, and wrote it to give my one cent on the<br>
>> crowd sourcing part.<br>
>><br>
>><br>
>><br>
>> At an Erlang process level operations can be timed, as they directly map to<br>
>> the operations at the underlying OS. And then you will have to add some<br>
>> extra cost for the process management by the OTP. This extra cost is a<br>
>> function of many variables like number of cores, configuration of<br>
>> schedulers, yielding frequency, length of process queue, GC and so on.<br>
><br>
> Right - the problem is not measuring how long the primitives take<br>
> it is making sense of the measurements.<br>
><br>
> Even arithmetic is problematic - how long does an integer multiply take?<br>
> - answer "it depends" - Erlang has bignums not fixnums.<br>
> The python cost model gives a time for multiplying integers, but for<br>
> bignums the time will depend upon the size of the bignums and this<br>
> depends upon the algorithm. Just looking at code, you can't see how<br>
> large the integers are.<br>
><br>
> From what I've seen extrapolation from "programs in the small" (ie<br>
> answering question like - "how long does an integer multiply take") to<br>
> "programs in the large" (ie millions of processes collaborating to<br>
> provide a service) is very hard.<br>
><br>
> Cheers<br>
><br>
> /Joe<br>
><br>
><br>
><br>
> There<br>
>> is no straightforward way, but through a deeper analysis they can be<br>
>> determined.<br>
>><br>
>><br>
>><br>
>> Theepan<br>
>><br>
>><br>
>> On Wed, Sep 16, 2015 at 8:33 PM, Eric des Courtis<br>
>> <<a href="mailto:eric.des.courtis@benbria.ca">eric.des.courtis@benbria.ca</a>> wrote:<br>
>>><br>
>>> What is the cost model of all operations in Erlang 18?<br>
>>><br>
>>> For example Python has this cost model<br>
>>> <a href="http://scripts.mit.edu/~6.006/fall07/wiki/index.php?title=Python_Cost_Model" rel="noreferrer" target="_blank">http://scripts.mit.edu/~6.006/fall07/wiki/index.php?title=Python_Cost_Model</a><br>
>>> .<br>
>>><br>
>>> I either want a link to a single source for this information or I would<br>
>>> like to crowd source the information here now.<br>
>>><br>
>>> Thanks for your cooperation.<br>
>>><br>
>>> Eric des Courtis<br>
>>><br>
>>> _______________________________________________<br>
>>> erlang-questions mailing list<br>
>>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
>>> <a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
>><br>
>><br>
>> _______________________________________________<br>
>> erlang-questions mailing list<br>
>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
>> <a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>