<div dir="ltr"><div>On Wed, May 7, 2014 at 4:37 PM, Ryosuke Niwa <span dir="ltr">&lt;<a href="mailto:rniwa@webkit.org" target="_blank">rniwa@webkit.org</a>&gt;</span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div class="h5">On Wed, May 7, 2014 at 4:36 PM, Ryosuke Niwa <span dir="ltr">&lt;<a href="mailto:rniwa@webkit.org" target="_blank">rniwa@webkit.org</a>&gt;</span> wrote:<br>

</div></div><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>On Mon, May 5, 2014 at 8:02 PM, Rik Cabanier <span dir="ltr">&lt;<a href="mailto:cabanier@gmail.com" target="_blank">cabanier@gmail.com</a>&gt;</span> wrote:<br>


</div><div class="gmail_extra"><div class="gmail_quote"><div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">On Mon, May 5, 2014 at 6:23 PM, Oliver Hunt <span dir="ltr">&lt;<a href="mailto:oliver@apple.com" target="_blank">oliver@apple.com</a>&gt;</span> wrote:<br>



<div class="gmail_extra"><div class="gmail_quote"><div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">On May 5, 2014, at 6:13 PM, Rik Cabanier &lt;<a href="mailto:cabanier@gmail.com" target="_blank">cabanier@gmail.com</a>&gt; wrote:<div>



<div><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Do you really want a page to know that you have a  fancy-pants 24-core Mac Pro rather than a little Mac mini?</div>





</div></blockquote><div><br></div><div>Yes!</div><div>If I have 24 cores ready to do work and the page can put them to use, I would like it to do so.</div><div>At the same time, if I just have a old mac mini, I don&#39;t want the page to launch 24 workers as that will exhaust my memory and cause contention. </div>




</div></div></div></blockquote><div><br></div></div><div>But I don&#39;t have 24 cores available, i have 24 cores installed.  You have no idea what the actual workload of the system is, you don&#39;t know whether any other tabs are also using workers, you only have one piece of information, and that is nowhere near sufficient to make a reasonable choice.</div>




</div></div></blockquote><div><br></div></div><div>Sure, if I have 2 tabs and each one consumes all my CPU resources, things will run at half the speed and maybe even worse because of we would use more memory.</div></div>



</div></div></blockquote><div><br></div></div><div>At most at half the speed; it could be significantly worse if each worker ended up accessing completely different parts of RAM, etc...</div><div><br></div><div>Furthermore, the performance characteristics of 4 physical cores with SMT enabled for the total of 8 logical cores is substantially different from that of a system with 4 physical cores without SMT (4 logical) or 8 physical cores without SMT (8 logical).  In some cases, distributing work among 8 threads concurrently in such a system (4 physical cores with SMT) results in a much worse performance than doing so among 4 threads.</div>



<div></div></div><br></div><div class="gmail_extra">So while I agree that providing some API to let developers know of the number of threads that could be ran concurrently</div></div></blockquote><div><br></div></div></div>

<div>is useful</div><div class="">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">, I&#39;m not certain the number of installed cores is a good metrics for that.</div>

</div></blockquote></div></div></div></div></blockquote><div><br></div><div>I&#39;ll throw in another point that waking up all physical cores may result in a higher power usage compared to running the exact same task in a single core for a longer period of time.  So we may need to take that into account as well.</div>

<div><br></div><div>How about exposing something like the number of preferred concurrent threads, which UA can adjust dynamically and maybe have an event that notifies that the value has changed.</div><div><br></div><div>

- R. Niwa</div><div><br></div></div></div></div>