cfbolz changed the topic of #pypy to: #pypy PyPy, the flexible snake https://pypy.org | IRC logs: https://quodlibet.duckdns.org/irc/pypy/latest.log.html#irc-end and https://libera.irclog.whitequark.org/pypy | the pypy angle is to shrug and copy the implementation of CPython as closely as possible, and staying out of design decisions
jcea has quit [Quit: jcea]
jcea has joined #pypy
jcea has quit [Ping timeout: 256 seconds]
luka has joined #pypy
luka has quit [Remote host closed the connection]
luka has joined #pypy
luka has quit [Client Quit]
luka has joined #pypy
luka has quit [Client Quit]
luka has joined #pypy
luka has quit [Client Quit]
lukakov has joined #pypy
lukakov has quit [Client Quit]
lukakovacic has joined #pypy
lukakovacic has quit [Client Quit]
lukakovacic has joined #pypy
lukakovacic has quit [Quit: WeeChat 3.7.1]
lukakovacic has joined #pypy
Guest98 has joined #pypy
Guest98 has quit [Client Quit]
lukakovacic has quit [Ping timeout: 268 seconds]
lukakovacic has joined #pypy
lukakovacic has quit [Client Quit]
lukakovacic has joined #pypy
lukakovacic has quit [Client Quit]
lukakovacic has joined #pypy
<lukakovacic> Hello
<lukakovacic> I have a question regarding the potential use of the Python 3 typing module in PyPy JIT or perhaps even RPython
<lukakovacic> Would it be possible to use type hints to "speed up" the interpreter?
<lukakovacic> or even skip the interpreter completely (using RPython)?
<lukakovacic> and I know that the CPython runtime does not enforce the type annotations
<nimaje> they are hints, if they are enforced you have some other language, not python
<lukakovacic> The question is really: Is it possible to find some middle ground between Python being a dynamically typed language and a statically typed language, by using types, where you want to? In the sense that you would not need to do any runtime checking inside a function, which is "fully statically typed"?
<nimaje> there was the idea to use those hints as a first guess in the jit, but no idea if anyone worked on it in any way
<lukakovacic> Yes, this is what I am thinking about, also PEP 484 mentions the potential for use in the JIT.
<nimaje> RPython is a statically typed language and came before python 3 and type hints, so it has its own way to tell the compiler types, afaik it is python 2, so no way to integrate the hints there; if/when RPython supports python 3, someone could think about integrating those hints in the other typing stuff RPython has
<xorAxAx> the PyPy jit doesnt need type hints to figure out the types
<xorAxAx> on the python level
<xorAxAx> but you can use jit hints i think
<lukakovacic> xorAxAx: do you think there could be a performance benefit from using these hints in the JIT (once implemented)?
<xorAxAx> lukakovacic: no need to implement them in the JIT, you can do it completely at application level
<xorAxAx> lukakovacic: by e.g. generating isinstance guards into the functions in an import hook
<xorAxAx> that will magically speed up certain types of python apps on pypy
<lukakovacic> so that is already an optimization done by the JIT?
<xorAxAx> its done automatically, yes
<xorAxAx> if you bring the type hints into code flow. i am not sure it would work automatically without the suggested transformation
<lukakovacic> yes, I was asking more about the possibility of improving the JIT to recognize these types, so an optimization could be made.
<lukakovacic> i am looking at how to improve python to utilize gruadual typing a bit more, if that makes sense
<lukakovacic> i understand that type hints themselves should not enforce a certain type (like isinstance would for example)
<xorAxAx> lukakovacic: note that the suggested transformation changes the semantics for the average program and would crash most programs with type annotations
<xorAxAx> for obvious reasons: type annotations without using mypy are often wrong
<lukakovacic> yes, I understand. Type hints must be hints
<lukakovacic> not enforced
<xorAxAx> thats automatically used already by the jit
<lukakovacic> but, what about using a decorator, which would tell RPython or the JIT that type hints should be enforced for a certain function?
<xorAxAx> thats not a pypy question but a python question
<xorAxAx> i.e. the decorator would change semantics on all interpreters (for good)
<lukakovacic> yes, I know this question is more for the Python implementation itself, but I am asking to see, whether this is viable at all
<xorAxAx> and speed up on pypy because of the introduced isinstance branch
<nimaje> xorAxAx: the question was about using the type hint as a first guess in the type analysis of the jit and as said, the idea was already there, but I don't know if anything further happend
<nimaje> but you don't want to pessimize, because the hint was completely wrong, so I expect it to be hard to integrate those hints in the jit
<xorAxAx> lukakovacic: its nearly trivial
<xorAxAx> nimaje: ah, thats probably harder to implement on the python level
<xorAxAx> not sure there are primitives in pypyjit to support that, maybe cfbolz knows
<nimaje> lukakovacic: ah, yeah, if you do a decorator, then adding assert isinstance(…) at the start of the function should help, not sure what to do with variables inside the function, but you can probably let the jit handle these itself
<lukakovacic> Thank you both. What I am aiming at is having the produced binary be as simple as possible, without too much runtime overhead, where it is not necessary. I will look further into RPython, it seems interesting.
lukakovacic has quit [Quit: WeeChat 3.7.1]
<cfbolz> I think Cinder (meta's CPython fork) has a bunch of features like this
<xorAxAx> is it faster than pypy? :)
Dejan has joined #pypy
<cfbolz> clear "maybe"
<xorAxAx> hehe
jinsun has quit [Quit: No Ping reply in 180 seconds.]
jinsun has joined #pypy
jinsun has quit [Quit: No Ping reply in 180 seconds.]
jinsun has joined #pypy
jinsun has quit [Client Quit]
jinsun has joined #pypy
jcea has joined #pypy
dmalcolm__ has joined #pypy
dmalcolm_ has quit [Ping timeout: 256 seconds]