These are chat archives for dropbox/pyston

14th
Dec 2015
An Long
@aisk
Dec 14 2015 03:01
@kmod got, I’ll try it latter
Mark Wassell
@mpwassell
Dec 14 2015 09:51
Hello, I am trying to understand how different versions of a function are compiled based on their type signature. I have a function that simply adds two numbers and call it repeatedly with integer arguments. However when it is JIT'ed, I get the type AnyBox. I would expect some specialisation to integer.
JIT'ing i.py:add with signature (AnyBox, AnyBox) -> AnyBox at effort level 3 with exception style C++
Kevin Modzelewski
@kmod
Dec 14 2015 12:20
hmm that's interesting
if you can post the code somewhere I can take a look
I would expect the specialization to happen too :)
Mark Wassell
@mpwassell
Dec 14 2015 12:25
def add(x,y): return x+y for i in range(10000): z = add(1,2)
Or is it because it has been disabled - see line 1707 of ast_interpreter.cpp
Sun
@Daetalus
Dec 14 2015 12:26
Hi, some numpy tests fixing took me a lot of time. For example, an error report: ValueError: setting an array element with a sequence., it just because int lack of __long__ attribute. So I plan to let Pyston's numeric types have fully support first. Regards complex, use pure CPython implementation like unicode, or use mixed implementation like float?
Kevin Modzelewski
@kmod
Dec 14 2015 12:30
oh right, argument type specialization might be disabled
in general we are not getting very much from that kind of technique (cross-bytecode type analysis) just yet
so I think it got turned off during a refactor
Marius Wachtler
@undingen
Dec 14 2015 12:50
I think we turned it of because AFAIK if created once a specialized version there is currently no mechanism to generate a non specialized one. So in case if we call the function with a lot of different types, so we would generate a lot of different functions which ends up taking a lot of time to JIT
It should be quite easy to add such a back off mechanism but I tried it once and it didn't speed up any of our large benchmarks.
Marius Wachtler
@undingen
Dec 14 2015 13:05
@Daetalus My opinion: It depends on how much is missing in the complex module. If it's only a small thing like a missing method I would stick to the mixed implementation because it has some type specific implementations of the arithmetic ops. If there is something a little bit larger missing / wrong I would switch to the cpythons implementation as a whole. Sorry that is not much of a help, especially because you are much more familiar with the complex impl...
Sun
@Daetalus
Dec 14 2015 13:24
@undingen Thanks for your suggestion!