I tried that logging option once, but I didn&#39;t know how to read the logs. They&#39;re not exactly self explanatory. Is there a resource somewhere that explains how to read those logs?<div><br></div><div>Regardless, I&#39;ve implemented your suggestion and moved reads from that dictionary to a function decorated with @purefunction. Indeed, performance is greatly improved! Thanks!</div>

<div><br></div><div>Current version:</div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="https://bitbucket.org/brownan/bf-interpreter/src/d3394345272e/targetbf.py">https://bitbucket.org/brownan/bf-interpreter/src/d3394345272e/targetbf.py</a></div>

<div><br></div><div>A few questions:</div><div><br></div><div>When the optimizer encounters a &quot;pure&quot; function, it must compare the objects passed in to previous invocations... does it consider the contents of container or other mutatible objects? or just the object identity, to be part of the function&#39;s input?</div>

<div>It looks like, from logs of my new version, it&#39;s not reading from the dictionary at all during the trace, so I would guess it&#39;s not considering the actual contents of the dictionary as part of the function&#39;s input. This isn&#39;t surprising, but I just want to know for sure.</div>

<div>
<div><br></div><div>Second, I noticed in jit.py the function hint() which has a parameter: &quot;promote - promote the argument from a variable into a constant&quot;. Could this be an appropriate alternate to the @purefunction solution? Or, I&#39;m guessing, does it just mean the name bracket_map won&#39;t change bindings, but does not impose a restriction on mutating the dictionary?</div>

<div><br></div><div>-Andrew<br>
<br><div class="gmail_quote">On Fri, Mar 25, 2011 at 2:18 PM, Armin Rigo <span dir="ltr">&lt;<a href="mailto:arigo@tunes.org" target="_blank">arigo@tunes.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Hi Andrew,<br>
<div><br>
On Fri, Mar 25, 2011 at 5:47 PM, Andrew Brown &lt;<a href="mailto:brownan@gmail.com" target="_blank">brownan@gmail.com</a>&gt; wrote:<br>
&gt; Thanks, it does indeed work now!<br>
<br>
</div>The next step is to have a look at the traces produced (run with<br>
PYPYLOG=jit-log-opt:logfile), and spot the obvious missing<br>
optimizations.  The biggest issue seems to be the fact that the<br>
dictionary &#39;bracket_map&#39; is green, but it is not enough to ensure that<br>
it is a constant dict (it could be mutated behind the JIT&#39;s back); so<br>
in the end, every trace contains reads from it.  You could fix it by<br>
moving the line<br>
<br>
            newpc = bracket_map[pc]<br>
<br>
to a new function to which you apply the decorator @pypy.rlib.jit.pure_function.<br>
<br>
<br>
A bientôt,<br>
<font color="#888888"><br>
Armin.<br>
</font></blockquote></div><br></div>
</div>