### Size limit

Tuom Larsen <tuom.larsen <at> gmail.com>

2015-10-06 17:32:00 GMT

Hello!
I have a piece of auto-generated code and I noticed that if a function
has more than certain number of expressions it starts to run much
slower.
I'm guessing this has something to do with what JIT considers to be
still worth of compiling but I just would like to confirm this: is
there any limit on how big (in term of operations) a function needs to
be in order to get compiled by JIT? Is it possible to increase the
limit from user code? Or is there any other reason for the slowdown?
Please find below an arficial example. Here it turn in ~0.13 seconds
but when I uncomment the first line it drops to 5.3 seconds.
Thanks,
Tuom Larsen
def f(x):
a0 = x*0.1; a1 = x*0.1; a2 = x*0.2; a3 = x*0.3; a4 = x*0.4
a5 = x*0.5; a6 = x*0.6; a7 = x*0.7; a8 = x*0.8; a9 = x*0.9
b0 = x*0.1; b1 = x*0.1; b2 = x*0.2; b3 = x*0.3; b4 = x*0.4
b5 = x*0.5; b6 = x*0.6; b7 = x*0.7; b8 = x*0.8; b9 = x*0.9
return sum([
# (a0+a1+a2+a3+a4+a5+a6+a7+a8+a9)*(b0+b1+b2+b3+b4+b5+b6+b7+b8+b9),
(a0+a1+a2+a3+a4+a5+a6+a7+a8+a9)*(b0+b1+b2+b3+b4+b5+b6+b7+b8+b9),
(a0+a1+a2+a3+a4+a5+a6+a7+a8+a9)*(b0+b1+b2+b3+b4+b5+b6+b7+b8+b9),
(a0+a1+a2+a3+a4+a5+a6+a7+a8+a9)*(b0+b1+b2+b3+b4+b5+b6+b7+b8+b9),
(a0+a1+a2+a3+a4+a5+a6+a7+a8+a9)*(b0+b1+b2+b3+b4+b5+b6+b7+b8+b9),
(a0+a1+a2+a3+a4+a5+a6+a7+a8+a9)*(b0+b1+b2+b3+b4+b5+b6+b7+b8+b9),
(a0+a1+a2+a3+a4+a5+a6+a7+a8+a9)*(b0+b1+b2+b3+b4+b5+b6+b7+b8+b9),
(a0+a1+a2+a3+a4+a5+a6+a7+a8+a9)*(b0+b1+b2+b3+b4+b5+b6+b7+b8+b9),
(a0+a1+a2+a3+a4+a5+a6+a7+a8+a9)*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