[pypy-dev] Size limit

Maciej Fijalkowski fijall at gmail.com
Wed Oct 7 12:44:16 CEST 2015


we found quite a few problems with the current heuristic so we'll put
some effort into it some time soon.

On Wed, Oct 7, 2015 at 12:17 PM, Tuom Larsen <tuom.larsen at gmail.com> wrote:
> Thanks, even trace_limit=9000 is sufficient in my case!
>
> That heuristic would be most awesome so that other people don't have
> to manually override the limit. I'm guessing it is more complicated
> than that but simplify lifting the limit to, say, 12000 wouldn't
> suffice?
>
> On Wed, Oct 7, 2015 at 11:26 AM, Maciej Fijalkowski <fijall at gmail.com> wrote:
>> Hi Tuom. It's the limit of number of operations while compiling. It
>> can be (globally) edited using:
>>
>> pypy --jit trace_limit=some-number
>>
>> default is 6000. --jit help will show you some information. We should
>> improve the heuristic to always trace a function that's the only one
>> maybe though
>>
>> On Tue, Oct 6, 2015 at 7:32 PM, Tuom Larsen <tuom.larsen at gmail.com> wrote:
>>> 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)*(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)*(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)*(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)*(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)*(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)])
>>>
>>>     for i in range(100000):
>>>         f(0.1)
>>> _______________________________________________
>>> pypy-dev mailing list
>>> pypy-dev at python.org
>>> https://mail.python.org/mailman/listinfo/pypy-dev


More information about the pypy-dev mailing list