On Wed, Feb 2, 2011 at 4:07 PM, Jacob Hallén <ja...@openend.se> wrote: > onsdag 02 februari 2011 03.09.09 skrev Łukasz Ligowski: >> >> I'd like to ask are there any rules of thumb to write code that PyPy JIT >> can easily optimize? Or maybe which constructs are hardly optimizable by >> JIT so it's better to avoid them? > > If you want absolutely best performance, write your code in a simple, straight > forward way, trying to keep your most used loops free of branches. > > if a: > for x in range(big number): > calculate something > else: > for x in range(big number): > calculate something else > > generates better code than > > for x in range(big number): > if a: > calculate something > else: > caculate something else > > In the second case, there will be a guard inside the loop that has to be > evaluated every time through.
You have outdated information Jacob, not any more :) > > Jacob Hallén > _______________________________________________ > pypy-dev@codespeak.net > http://codespeak.net/mailman/listinfo/pypy-dev _______________________________________________ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev