<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt">I'll email the code separetely because I'm not sure everyone wants a tiny zip.  Anyone is welcome to it.  It's a newer version of the compressor I entered into the Large Text Compression Benchmark.<br><br>I'm running it as:<br><br>PYPYLOG=jit-log-opt,jit-backend:dizlog.pypylog pypy diz.py -p -t frank.txt<br><br>You can get frank.txt from http://www.gutenberg.org/ebooks/84 (and rename it) or substitute a similar file.<br><br><br>Examine the second line in output():<br><br><span class="tab">    </span> if (self.low ^ self.high) & 0x80000000 == 0:<br><br>The remaining lines are similar.  Also, the routine encode() listed one line above in jitviewer has the same issues.  If I comment out the two calls to encode(), I save a huge percentage of time (up to 40% in some
 configurations).<br><br><br><div><span>-Roger<br></span></div><div><br></div>  <div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Alex Gaynor <alex.gaynor@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> Roger Flores <aidembb@yahoo.com> <br><b><span style="font-weight: bold;">Cc:</span></b> "pypy-dev@python.org" <pypy-dev@python.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, February 27, 2013 12:35 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [pypy-dev] Slow int code<br> </font> </div> <br>
<div id="yiv1851963147"><div dir="ltr">The original source code would be best!<div><br></div><div>Thanks,</div><div>Alex</div></div><div class="yiv1851963147gmail_extra"><br><br><div class="yiv1851963147gmail_quote">On Wed, Feb 27, 2013 at 12:32 PM, Roger Flores <span dir="ltr"><<a rel="nofollow" ymailto="mailto:aidembb@yahoo.com" target="_blank" href="mailto:aidembb@yahoo.com">aidembb@yahoo.com</a>></span> wrote:<br>
<blockquote class="yiv1851963147gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div style="font-size:12pt;font-family:arial, helvetica, sans-serif;">Would you like a paste from jitviewer or the source code to run and examine with jitviewer?<span class="yiv1851963147HOEnZb"><font color="#888888"><br>
<br>-Roger<br></font></span><div class="yiv1851963147hm yiv1851963147HOEnZb"><div><span><br></span></div><div><br></div>  </div><div style="font-family:arial, helvetica, sans-serif;font-size:12pt;"><div class="yiv1851963147hm yiv1851963147HOEnZb"> </div><div style="font-family:times new roman, new york, times, serif;font-size:12pt;">
<div class="yiv1851963147hm yiv1851963147HOEnZb"> <div dir="ltr"> <font face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Alex Gaynor <<a rel="nofollow" ymailto="mailto:alex.gaynor@gmail.com" target="_blank" href="mailto:alex.gaynor@gmail.com">alex.gaynor@gmail.com</a>><br>
 <b><span style="font-weight:bold;">To:</span></b> Roger Flores <<a rel="nofollow" ymailto="mailto:aidembb@yahoo.com" target="_blank" href="mailto:aidembb@yahoo.com">aidembb@yahoo.com</a>> <br><b><span style="font-weight:bold;">Cc:</span></b> "<a rel="nofollow" ymailto="mailto:pypy-dev@python.org" target="_blank" href="mailto:pypy-dev@python.org">pypy-dev@python.org</a>" <<a rel="nofollow" ymailto="mailto:pypy-dev@python.org" target="_blank" href="mailto:pypy-dev@python.org">pypy-dev@python.org</a>> <br>
 <b><span style="font-weight:bold;">Sent:</span></b> Wednesday, February 27, 2013 12:23 PM<br> <b><span style="font-weight:bold;">Subject:</span></b> Re: [pypy-dev] Slow int
 code<br> </font> </div></div><div><div class="yiv1851963147h5"> <br>
<div><div dir="ltr">In that context large longs means HUNDREDS or THOUSANDS of bits, not 64 :) Can you show us a full runnable example that illustrates this?<div><br></div><div>Alex</div></div><div><br><br><div>
On Wed, Feb 27, 2013 at 12:10 PM, Roger Flores <span dir="ltr"><<a rel="nofollow" ymailto="mailto:aidembb@yahoo.com" target="_blank" href="mailto:aidembb@yahoo.com">aidembb@yahoo.com</a>></span> wrote:<br><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi guys.  I've been looking at two simple routines using jitviewer to figure out why they're so much slower than expected.<br>
<br>
<br>
I've also noticed that http://pypy.org/performance.html has the line "Bad examples include doing computations with<br>
large longs – which is performed by unoptimizable support code.".  I'm worried that my 32 bit int code is falling into this, and I'm wondering what I can do to avoid it?<br>
<br>
Trivial code like<br>
<br>
if (self.low ^ self.high) & 0x80000000 == 0:<br>
<br>
<br>
is expanding into several dozen asm instructions.  I'm suspecting that lines like <br>
<br>
self.low = (self.low << 1) & 0xffffffff<br>
<br>
<br>
with it's shift left are convincing the jit to consider the int to need 64 bits (large long?) instead of 32.<br>
<br>
<br>
Ideas?  The asm is clearly operating on QWORDs and calling routines to do the bit arithmetic instead of single instructions.  Is this what that line in performance.html is warning about?<br>
<br>
<br>
<br>
-Roger<br>
<br>
BTW Fijal's jitviewer is a *must see* for anyone interested in how pypy makes their code fast!<br>
<br>
_______________________________________________<br>
pypy-dev mailing list<br>
<a rel="nofollow" ymailto="mailto:pypy-dev@python.org" target="_blank" href="mailto:pypy-dev@python.org">pypy-dev@python.org</a><br>
http://mail.python.org/mailman/listinfo/pypy-dev<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>"I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire)<br>"The people's good is the highest law." -- Cicero<br>


</div>
</div><br><br> </div></div></div> </div>  </div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>"I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire)<br>
"The people's good is the highest law." -- Cicero<br>
</div>
</div><br><br> </div> </div>  </div></body></html>