![](https://secure.gravatar.com/avatar/e06064361f4e9fb1bd46046b78fae409.jpg?s=120&d=mm&r=g)
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