<div dir="ltr"><br><br><div class="gmail_quote">On Sun, Sep 7, 2008 at 4:56 AM, David Griswold <span dir="ltr">&lt;<a href="mailto:david.griswold.256@gmail.com">david.griswold.256@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div dir="ltr"><div><div></div><div class="Wj3C7c"><br><br><div class="gmail_quote">On Sun, Sep 7, 2008 at 4:22 AM, Paolo Bonzini <span dir="ltr">&lt;<a href="mailto:bonzini@gnu.org" target="_blank">bonzini@gnu.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br>
&gt; Also, compiling code that isn&#39;t in a hotspot is a waste of time, since<br>
&gt; you spend much longer compiling the code than you would have spent<br>
&gt; interpreting it, and can cause big compile pauses if the compiler does<br>
&gt; much optimization.<br>
<br>
</div>You can use a simple 1-pass compilation (without even register<br>
allocation) that takes just a few ms for any reasonable amount of code.<br>
&nbsp;Don&#39;t forget that V8 runs (mainly) in a browser--if the browser is<br>
sufficiently snappy, the user won&#39;t notice a compilation pause of a few<br>
milliseconds.<br></blockquote></div><br></div></div><div>Such a compiler is fast, but it produces verbose code. &nbsp;I was talking about a <span style="font-weight:bold">large</span>&nbsp;body of code, the sort that might begin to be used if V8 is used on the desktop for things like running an entire Smalltalk image, for example. &nbsp;In those sorts of cases,&nbsp;there is a difficult trade-off: if you use a fast compiler like the one you are talking about, it produces verbose code that consumes a lot of space, which was the problem for Self. &nbsp;On the other hand if you use a good compiler that produces more compact code, then you get large compilation pauses. &nbsp;</div>

<div><br></div><div>Using a code cache like in Visualworks or mixed-mode hotspot compilation like we did in Strongtalk and the JVM is how to get around that trade-off. &nbsp; The question is, what does V8 do to solve this problem? &nbsp;That is not yet clear. &nbsp;If they don&#39;t have some compact way of representing and executing uncommonly-used code, then it will have problems with large bodies of code.</div>
</div></blockquote><div><br></div><div>David is exactly right. &nbsp;I think v8 does not yet have to face this problem because it is compiling javascript programs in web pages where the largest programs are a few hundred k bytes of source (e.g. the lively kernel at around 300k).</div>
<div><br></div><div>That doesn&#39;t invalidate v8 for its intended use. &nbsp;As they find it doesn&#39;t scale they&#39;ll have to evolve the implementation. &nbsp;But right now v8 is the fasted js engine on the planet and it works just fine :)</div>
</div><br></div>