On 14/04/11 16:44, Hakan Ardo wrote: > Second though, that will recompile on every call, but if we cache the > promote functions: > > def main(n, promoters={}): > i, a = 0, 0 > if n not in promoters: > exec """def promote(n): > assert n==%d""" % n > promoters[n] = promote > else: > promote = promoters[n] > while i < n: > promote(n) > a += i+5 > i += 1 > return a > > we will actualy get rid of the extra ptr_eq and guard_false too...
wow, that's advanced... and without knowing the internals of the JIT, it really looks like black magic. While we are at it and if you have time/feel like, could you please have a look to test_zeropadded and test_circular in test_pypy_c_new? It's not clear to me what they are supposed to check (note that it's fine if you say "they just check that the program works correctly" :-)). _______________________________________________ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev