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.
Jacob Hallén
_______________________________________________
[email protected]
http://codespeak.net/mailman/listinfo/pypy-dev