From 556aaea4de535d02e46d400d131af4ca74cbb046 Mon Sep 17 00:00:00 2001 From: Manikantagit Date: Mon, 15 Nov 2021 19:28:09 +0530 Subject: [PATCH] 340-pyjion-1-0.txt--updated updated --- transcripts/340-pyjion-1-0.txt | 408 ++++++++++++++++----------------- 1 file changed, 203 insertions(+), 205 deletions(-) diff --git a/transcripts/340-pyjion-1-0.txt b/transcripts/340-pyjion-1-0.txt index f811dc62..761da7ff 100644 --- a/transcripts/340-pyjion-1-0.txt +++ b/transcripts/340-pyjion-1-0.txt @@ -4,9 +4,9 @@ 00:00:04 This time we welcome back friend of the show, Anthony Shaw. -00:00:07 He's here to share the massive amount of work that he's been doing to answer that question and speed up things where the answer is yes, it he just released version. One of the Pigeon project, Pigeon is a drop in Git compiler for Python 310. +00:00:07 He's here to share the massive amount of work that he's been doing to answer that question and speed up things where the answer is yes, and he just released version 1.0 of the Pyjion project, Pyjion is a drop in Git compiler for Python 310. -00:00:23 It uses the Net Six cross platform Jet to compile and optimize Python code on the fly with zero changes to your source code. +00:00:23 It uses the .NET 6 cross platform JIT to compile and optimize Python code on the fly with zero changes to your source code. 00:00:31 It runs on Linux. @@ -22,19 +22,19 @@ 00:00:44 2021. -00:00:58 Welcome to Talk Pythonomy, a weekly podcast on Python. +00:00:58 Welcome to Talk Python to Me, a weekly podcast on Python. 00:01:01 This is your host, Michael Kennedy. -00:01:03 Follow me on Twitter where I'm at McKinney and keep up with the show and listen to past episodes at Talkpython FM and follow the show on Twitter via at Talk Python. +00:01:03 Follow me on Twitter where I'm @mkennedy and keep up with the show and listen to past episodes at 'Talkpython.FM' and follow the show on Twitter via at Talk Python. -00:01:12 We started streaming most of our episodes live on YouTube, subscribe to our YouTube channel over at Talkpython FM. +00:01:12 We started streaming most of our episodes live on YouTube, subscribe to our YouTube channel over at Talkpython.FM. 00:01:19 Youtube to get notified about upcoming shows and be part of that episode. -00:01:24 This episode is brought to you by Shortcut and Lenode and the transcripts are sponsored by assembly AI Anthony Shaw. +00:01:24 This episode is brought to you by Shortcut and Linode and the transcripts are sponsored by 'assemblyAI' Anthony Shaw. -00:01:32 Welcome to Talk by The Enemy. +00:01:32 Welcome to Talk Python to Me. 00:01:34 Hi, Michael. Good to see you again. @@ -64,7 +64,7 @@ 00:02:19 This time we're here to talk about a project that you've been spearheading for the last year or so. -00:02:23 Pigeon, which is a Jet compiler for Python, which is pretty awesome. +00:02:23 Pyjion, which is a JIT compiler for Python, which is pretty awesome. 00:02:29 Yeah. @@ -74,11 +74,11 @@ 00:02:44 Yeah. C Python internals book. -00:02:46 Yeah. It was really interesting to dig into a compiler, and I really wanted to put some of that area into practice and work on my own compiler. So. +00:02:46 Yeah. It was really interesting to dig into a compiler, and I really wanted to put some of that theory into practice and work on my own compiler. So. 00:02:55 Yeah, that's kind of what led to it. -00:02:57 It looks like no small feat, as people will see as we get into it. But how much did the diving into the sea internals make you feel like, all right, I'm ready to actually start messing with this and messing with how it runs and compiling machine instructions. +00:02:57 It looks like no small feat, as people will see as we get into it. But how much did the diving into the C internals make you feel like, all right, I'm ready to actually start messing with this and messing with how it runs and compiling machine instructions. 00:03:11 Yeah. Massively. @@ -92,21 +92,21 @@ 00:03:23 I didn't understand how it could work, and I just really wanted to learn, and it seemed like a really big challenge. So yeah, I looked at it and thought, this is an interesting thing. -00:03:33 I know that Brett, and we're no longer working on it and just decided to pick it up and see how far I could take it. +00:03:33 I know that Brett, and Dino were no longer working on it and just decided to pick it up and see how far I could take it. 00:03:38 Yes, absolutely. -00:03:40 I think you've taken pretty far, and it's about to go to one0. Is that right? +00:03:40 I think you've taken pretty far, and it's about to go to 1.0. Is that right? 00:03:45 Yeah. -00:03:45 So it could be launching version 1.5 Pigeon in a few days. +00:03:45 So it could be launching version 1.0 Pyjion in a few days. -00:03:51 So I'm waiting for Net Six to be released, and I'll explain why, probably a bit later. +00:03:51 So I'm waiting for .NET6 to be released, and I'll explain why, probably a bit later. 00:03:56 Wait, hold on. -00:03:58 This is a Python project on a Python podcast. And you're waiting for Net Six. Oh, my gosh. I don't understand. +00:03:58 This is a Python project on a Python podcast. And you're waiting for .NET6. Oh, my gosh. I don't understand. 00:04:05 Yes. @@ -114,31 +114,31 @@ 00:04:06 And it did originally. I think when the project was written. -00:04:09 So it's a jet compiler for Python written in C Plus plus, and you could write your own Jet compiler, which is no small feat. +00:04:09 So it's a jit compiler for Python written in C++, and you could write your own Jit compiler, which is no small feat. 00:04:20 Yes. And then you'd be done in, like, ten years. 00:04:22 Exactly. -00:04:23 Or you can take a Jet compiler off the shelf. +00:04:23 Or you can take a Jit compiler off the shelf. -00:04:25 So a jet compiler compiles some sort of intermediary language into machine code assembly. +00:04:25 So a jit compiler compiles some sort of intermediary language into machine code assembly. -00:04:33 A lot of Git compilers are working with basically, like, which registers to use which operations and instructions are supported on different CPUs. +00:04:33 A lot of jit compilers are working with basically, like, which registers to use which operations and instructions are supported on different CPUs. 00:04:42 There's a whole bunch of stuff to work very involved. -00:04:47 And Netcore what was called Net Core now just Net has a Jet compiler in it. +00:04:47 And .NETcore what was called Net Core now just .NET has a Jit compiler in it. -00:04:53 And yes, you can actually use just the Jet compiler. +00:04:53 And yes, you can actually use just the Jit compiler. 00:04:57 So that's what the project originally did was to basically use the JIT compiler for Net Core. -00:05:04 Other jets for Python, some of them use the LLVM Git, and there's a few other jets as well. You can get off the shelf. +00:05:04 Other jits for Python, some of them use the LLVM jit, and there's a few other jits as well. You can get off the shelf. 00:05:11 So I started to use the Net one that was originally Dino and Brett when they built this. -00:05:17 It was actually before Net Core was even released. It was still in beta back then, but yeah, they used Net Corset. +00:05:17 It was actually before .Net Core was even released. It was still in beta back then, but yeah, they used .Net Core Jit. 00:05:22 Yeah. @@ -146,49 +146,47 @@ 00:05:28 I think back then you probably know this better than I do now. -00:05:32 But back then, I think there was like a fork in the road to pass for the Net world. You could do traditional Net on Windows only. +00:05:32 But back then, I think there was like a fork in the road to pass for the .Net world. You could do traditional Net on Windows only. -00:05:41 But that was like the 15 year polished version of dot Net. +00:05:41 But that was like the 15 year polished version of .Net. -00:05:45 And then there was this alternative, funky opensource dot net core thing that sort of derived, but was not the same thing as that. And so I think probably when Brett and Dino we're working, it was really early days on that version of the JIT compiler. +00:05:45 And then there was this alternative, funky opensource .Netcore thing that sort of derived, but was not the same thing as that. And so I think probably when Brett and Dino we're working, it was really early days on that version of the JIT compiler. -00:06:00 Yeah, it was version not .9 of Net core, right. +00:06:00 Yeah, it was version 0.9 of Net core, right. -00:06:02 So yeah, I did actually get involved back then just helping out upgrading it from version not zero nine. I've done a quarter version one. +00:06:02 So yeah, I did actually get involved back then just helping out upgrading it from version 0.9. I've got a call to version one. -00:06:10 So I did, like, help on the original Pigeon project with some of the builds and stuff. But that early version of Pigeon required a fork of CPython and a fork of Net core, so it required you to compile both projects from south with patches and stick a whole bunch of stuff together and very tricky to set up. +00:06:10 So I did, like, help on the original Pyjion project with some of the builds and stuff. But that early version of Pyjion required a fork of CPython and a fork of Net core, so it required you to compile both projects from sort with patches and stick a whole bunch of stuff together and very tricky to set up. -00:06:32 And that's one of the things when I kind of came in a year ago to pick this project up again that I really wanted to tackle was let's make it easy to install this, which means it should just be Pip installable, so you can just Pip install Pigeon right on Python. +00:06:32 And that's one of the things when I kind of came in a year ago to pick this project up again that I really wanted to tackle was let's make it easy to install this, which means it should just be Pip installable, so you can just Pip install Pyjion right on Python. 00:06:46 And that's the second thing I had to do was to upgrade it to the latest versions of Python, the latest versions of Net. -00:06:52 So yeah, it's running on Net six and C Python three point ten. +00:06:52 So yeah, it's running on Net6 and C Python 3.10 -00:06:58 It's basically a check compiler for Python. Three point ten. +00:06:58 It's basically a check compiler for Python 3.10. 00:07:01 Right. 00:07:02 So now we have Net. -00:07:04 I think they've closed that four because it's a little bit like the two to three boundary that we've crossed. It's just back to this Net thing, and it's open source, which is cool. +00:07:04 I think they've closed that fork because it's a little bit like the two to three boundary that we've crossed. It's just back to this Net thing, and it's open source, which is cool. -00:07:13 So that closes the Net jet side of things from a beta thing. +00:07:13 So that closes the .Net jit side of things from a beta thing. 00:07:18 On the other hand, there's a Pep, and I'm sure you know the number. I don't know the number off the top of my head that allowed for extensions into standard C Python, so you don't have to fork it and reprogram CFLC. 00:07:33 There's an extensible and extensibility layer for this kind of stuff now, right? Yes. -00:07:38 Maybe to backtrack a little bit. But when you write Python code and then execute it in Cyn, which is the most popular Python interpreter, the one you get from Python. - -00:07:47 Org. +00:07:38 Maybe to backtrack a little bit. But when you write Python code and then execute it in CPython, which is the most popular Python interpreter, the one you get from Python.org 00:07:47 When you compile the you don't compile the Python code. 00:07:50 Python does it for you. -00:07:52 When you compile Python code, it compiles down into an abstract syntax tree, and then the next level down is bytecode sequence, which you can see if you import the disk module and you run the dis function on your code. +00:07:52 When you compile Python code, it compiles down into an abstract syntax tree, and then the next level down is bytecode sequence, which you can see if you import the disk module and you run the disk function on your code. -00:08:08 I've got to talk about Pigeon, which I did in Python this year. +00:08:08 I've got to talk about Pyjion, which I did in PyCon this year. 00:08:12 We'll link that in the show notes. @@ -196,9 +194,9 @@ 00:08:16 So that's kind of the bite code. -00:08:18 And basically this looks at how can the bytecode gets handed off onto an evaluation loop in Python, which is called the Ceval. +00:08:18 And basically this looks at how can the bytecode gets handed off onto an evaluation loop in Python, which is called . -00:08:29 Is that one of the first things you looked at when you started diving into the sea source code? +00:08:29 Is that one of the first things you looked at when you started diving into the C source code? 00:08:34 Is that the first file you went to? @@ -206,19 +204,19 @@ 00:08:38 I remember on Python Bites last week, you mentioned that Lucas had been analyzing bits of Python that changed the most, and that was like, the most changed bit of Python. It's kind of like the brain of Python. Really. -00:08:50 It's a loop that evaluates all the instructions and then calls all the different CAIs to actually make your code do things. +00:08:50 It's a loop that evaluates all the instructions and then calls all the different CAPIs to actually make your code do things. -00:08:58 And what you can do in this Pep, which Brett proposed originally when he was working on Pigeon, was that you can actually tell Cpythen to not use its own evaluation loop, but use a replacement one. So this 523 it is you can basically write an extension module for Python and then say, okay, from now on, I will evaluate all Python code. +00:08:58 And what you can do in this Pep, which Brett proposed originally when he was working on Pyjion, was that you can actually tell Cpython to not use its own evaluation loop, but use a replacement one. So this 523 it is you can basically write an extension module for Python and then say, okay, from now on, I will evaluate all Python code. -00:09:23 Well, Python compiles it for you and then just give it to you as a bytecode code object with bytecodes in it, and then you can write custom function, which will evaluate those by codes. +00:09:23 Well, Python compiles it for you and then just give it to you as a bytecode code object with bytecodes in it, and then you can write custom function, which will evaluate those byte codes. 00:09:34 Right. Exactly. -00:09:35 Normally, there's just a switch statement that says, if I get this by code, here's what I do. If I get that by code, here's what I do. +00:09:35 Normally, there's just a switch statement that says, if I get this byte code, here's what I do. If I get that by code, here's what I do. 00:09:41 One of the drawbacks of that that makes it super hard to optimize, among other things. Is it's one statement at a time, right. -00:09:49 Like the co that switch statement, that loop doesn't go here's a series of possibly related opcodes make that happen. It goes, no, you need to load this variable now create this object, and there's just not a lot of room for optimization there. +00:09:49 Like the Ceval that switch statement, that loop doesn't go here's a series of possibly related opcodes make that happen. It goes, no, you need to load this variable now create this object, and there's just not a lot of room for optimization there. 00:10:07 You're not going to inline a function or do other types of things when it's instruction by instruction. @@ -226,9 +224,9 @@ 00:10:12 Exactly. -00:10:13 So what Pigeon does, essentially, is it implements that API. +00:10:13 So what Pyjion does, essentially, is it implements that API. -00:10:18 When you install Pigeon and activate Pigeon, which you do by importing Pigeon and then just doing Pigeon enable, it will tell CPython that Pigeon will be the function to evaluate all Python code from now on. +00:10:18 When you install Pyjion and activate Pyjion, which you do by importing Pyjion and then just doing Pyjion enable, it will tell CPython that Pyjion will be the function to evaluate all Python code from now on. 00:10:31 And when it sees a new function for the first time, instead of interpreting all the bytecode instructions, when you execute the function, it will basically interpret those ahead of time and then compile them into machine code instructions, and then store that machine code in memory and then reexecute it every time you run the function. @@ -238,25 +236,25 @@ 00:11:02 And then when you run the Python function, if it's already been compiled, it will then just run those instructions, right. -00:11:08 As standard jet stuff. It has to do at once. +00:11:08 As standard jit stuff. It has to do at once. 00:11:10 But then once it's hit one method, it's like, okay, this one here's the machine instructions for it. We're just going to reuse that, right. 00:11:17 Yeah. Because the computer needs machine code to do anything. -00:11:22 So something has to have compiled it down into machine code. And in the case of normal CPython, C, Python is written in C, and the C compiler has compiled that down into machine code, but it's a loop that it runs through for each bitecode instruction to go. Okay, this is an ad operator, so I'm going to take two objects off the stack, the left hand side on the right hand side, and then I'm going to call the ad function in the C API. +00:11:22 So something has to have compiled it down into machine code. And in the case of normal CPython, C, Python is written in C, and the C compiler has compiled that down into machine code, but it's a loop that it runs through for each bitecode instruction to go. Okay, this is an ad operator, so I'm going to take two objects off the stack, the left hand side on the right hand side, and then I'm going to call the add function in the CAPI. 00:11:49 Exactly. -00:11:50 I kind of got you diving down deep a little too quick. I do want to set the stage just a moment before we get into how all of this works, because understanding where you're coming from and understanding some of the problems you're trying to solve are really going to be helpful to see the value here. So back in April 2020, whenever Python was that virtual, the first virtual Python you had that talk called Why Python is Slow. And you talked about some interesting things that really set the stage for. +00:11:50 I kind of got you diving down deep a little too quick. I do want to set the stage just a moment before we get into how all of this works, because understanding where you're coming from and understanding some of the problems you're trying to solve are really going to be helpful to see the value here. So back in April 2020, whenever PyCon was that virtual, the first virtual PyCon you had that talk called Why Python is Slow. And you talked about some interesting things that really set the stage for. -00:12:20 Well, if you had a jet and you had all sorts of control over it as you do, how could it be faster? What could we do? +00:12:20 Well, if you had a jit and you had all sorts of control over it as you do, how could it be faster? What could we do? 00:12:26 Right. 00:12:26 So one of the things you talked about was this in body problem. -00:12:29 How C plus plus relative, say, Python? +00:12:29 How C++ relative, say, Python? 00:12:33 There's a bit of a difference there, but also Net core was a lot faster and really importantly, JavaScript was faster, right? @@ -270,7 +268,7 @@ 00:12:44 This is part of this lovely pandemic. -00:12:46 See, I covered the endbody problem, which is interesting because the endbody problem is a mathematical formula that calculates the position of the Jovial planet. +00:12:46 See, I covered the N-body problem, which is interesting because the N-body problem is a mathematical formula that calculates the position of the Jovial planet. 00:12:59 As soon as you have three or more, it starts to get super complicated, right? @@ -282,7 +280,7 @@ 00:13:28 Yeah. -00:13:28 In that talk, I dug into the details about why some of the reasons why that is and kind of the core of the in body algorithm is this. +00:13:28 In that talk, I dug into the details about why some of the reasons why that is and kind of the core of the N- body algorithm is this. 00:13:37 There's a few lines of code which basically look at floating point numbers, and it calculates does a big calculation. @@ -294,15 +292,15 @@ 00:13:58 But a number in C and a number in Python. These are not equivalent. Right. A floating point number in C is probably eight bytes on the stack. -00:14:06 A floating point number in Python is what is that? A Pi float object that's 50 bites and is out on the heat, probably separated in space from the other numbers in terms of like, it will cause more cash misses and flushes and all sorts of stuff. Right? Yeah. +00:14:06 A floating point number in Python is what is that? A Py float object that's 50 bites and is out on the heat, probably separated in space from the other numbers in terms of like, it will cause more cache misses and flushes and all sorts of stuff. Right? Yeah. 00:14:21 A floating point number in Python as an immutable object, and it's basically a wrapper around a double. 00:14:30 So basically you have to create a Python object to store the floating point number, and then if the value changes, you have to create a new one. -00:14:38 So the issue in End Body is that you have to create for one line of Python that just does a whole bunch of work to get a single answer. +00:14:38 So the issue in N-Body is that you have to create for one line of Python that just does a whole bunch of work to get a single answer. -00:14:47 Like a single fighting point number. +00:14:47 Like a single floating point number. 00:14:49 All the interim values in that calculation create like 18 objects, which are immediately discarded. @@ -312,11 +310,11 @@ 00:15:00 And Python is pretty efficient at allocating small objects. -00:15:04 But when you magnify that to the level that is seen in the end body problem, then yeah. That's why it's so slow effectively because it's creating all these temporary objects and then destroying them in the next operation. +00:15:04 But when you magnify that to the level that is seen in the N-Body problem, then yeah. That's why it's so slow effectively because it's creating all these temporary objects and then destroying them in the next operation. -00:15:20 This portion of Talk Python is brought to you by Shortcut. +00:15:20 This portion of Talk Python to Me is brought to you by Shortcut. -00:15:23 Formerly known as Clubhouse IO. +00:15:23 Formerly known as Clubhouse.IO. 00:15:25 Happy with your project management tool. @@ -336,17 +334,17 @@ 00:15:58 The work in these workflows is automatically tied into larger company goals. -00:16:02 It takes one click to move from a roadmap to a team's work to individual updates and back Hype version control integration. +00:16:02 It takes one click to move from a roadmap to a team's work to individual updates and back. Hype version control integration. 00:16:09 Whether you use GitHub. 00:16:10 GitLab or Bitbucket Clubhouse ties directly into them so you can update progress from the command line, keyboard friendly interface. The rest of Shortcut is just as friendly as their power bar, allowing you to do virtually anything without touching your mouse. -00:16:25 Throw that thing in the trash iteration, planning, set weekly priorities, and let Shortcut run the schedule for you with accompanying burn down charts and other reporting. +00:16:25 Throw that thing in the trash. Iteration-planning, set weekly priorities, and let Shortcut run the schedule for you with accompanying burn down charts and other reporting. -00:16:34 Give it a try over at Talkpython FM Shortcut. +00:16:34 Give it a try over at 'Talkpython.FM/Shortcut'. -00:16:39 Again, that's Talkpython FM shortcut. +00:16:39 Again, that's 'Talkpython.FM/shortcut'. 00:16:42 Choose Shortcut because you shouldn't have to project manage your project management. @@ -356,7 +354,7 @@ 00:16:58 Right? -00:16:58 Like, okay, this Python runtime is going to need a Pi, Int or Pi Long or Python or whatever, but we don't need to do all the intermediate steps that way. +00:16:58 Like, okay, this Python runtime is going to need a Py Int or Py Long or Py Float or whatever, but we don't need to do all the intermediate steps that way. 00:17:08 Right. @@ -366,7 +364,7 @@ 00:17:21 Yeah. Exactly. -00:17:22 So the principle behind some of the design ideas in Pigeon is that and in lots of other compilers, this is not something I came up with, but the idea is to try and keep things as efficient as possible by just carrying values on the CPU registers and then not allocating memory in the heap. +00:17:22 So the principle behind some of the design ideas in Pyjion is that and in lots of other compilers, this is not something I came up with, but the idea is to try and keep things as efficient as possible by just carrying values on the CPU registers and then not allocating memory in the heap. 00:17:41 And a floating point number fits in a CPU register. @@ -374,13 +372,13 @@ 00:17:49 So let's just carry those values on the registers and then do low level instructions to do addition and minus multiplication as well, but not divide because I found out Python has a whole bunch of, like, custom rules for division, so I can rely on the CPU instructions to do that. -00:18:09 So these are the types of things that well, maybe we could use this Pep five, two, three and some kind of compiler and turn it loose on this. +00:18:09 So these are the types of things that well, maybe we could use this Pep 5.23 and some kind of compiler and turn it loose on this. 00:18:19 I just earlier this week interviewed Guido and Mark Shannon about just general Python performance. They're working on a parallel branch of making Python faster, which is great. 00:18:31 So out of the live stream, Josh Peak asks. -00:18:33 Mark and Guido tease the potential of addition of a C Python 313. 14. +00:18:33 Mark and Guido tease the potential of addition of Jit CPython 3.13 3.14. 00:18:39 Would this potentially intersect with that project? @@ -392,17 +390,17 @@ 00:18:46 I haven't asked to be involved in that yet. I don't know if Mark Shannon's experience with compilers is like miles ahead of mine. -00:18:56 And to be Frank, Guido has invented the language so that their knowledge spouses quite substantially. +00:18:56 And to be Frank, Guido has invented the language so that their knowledge surpasses quite substantially. 00:19:03 Yeah. -00:19:04 I hope that the work done in this project will be insightful when they're designing the gym. +00:19:04 I hope that the work done in this project will be insightful when they're designing the jit. 00:19:11 And I've already spoken to both of them about this project and walk through like, what's working and what isn't because it's I guess it's quite a bit ahead, and it's dealing with some challenges which they're probably going to hit when they come to this, then. Yeah, it will stir them in that direction. 00:19:26 Cool. -00:19:27 Let's talk about compiling just for a bit, because I did a lot of C Plus plus. +00:19:27 Let's talk about compiling just for a bit, because I did a lot of C++. 00:19:32 I remember pressing compile the build button or the run, which would build and run, and you'd see it grind. @@ -410,7 +408,7 @@ 00:19:42 They would like their hard drive would like make noises there. -00:19:47 You would hear it compiling, even also in C sharp dot net. +00:19:47 You would hear it compiling, even also in C# .net 00:19:50 Compile, but less and much faster. @@ -422,7 +420,7 @@ 00:20:01 Yes, it happens. -00:20:02 You just don't see it, see, it happens behind the scenes that compiles it, but it doesn't compile it into machine code. It compiles it into by code. +00:20:02 You just don't see it, see, it happens behind the scenes that compiles it, but it doesn't compile it into machine code. It compiles it into byte code. 00:20:09 Right. Which is the same as Net and Java. But the difference is what happens to that by code. @@ -452,21 +450,21 @@ 00:21:22 Right. -00:21:22 One of the big benefits of Jet is it can look exactly at what you're running on and say, oh, this has this vectorized hardware thing. So let's use that version here or this has this type of threading. +00:21:22 One of the big benefits of Jit is it can look exactly at what you're running on and say, oh, this has this vectorized hardware thing. So let's use that version here or this has this type of threading. -00:21:33 So we're going to do some sort of memory management around that C use C ahead of time compilers. They will interpret your code, parse it and compile it down into machine code instructions, and then put it in a binary format, like a shared library or a standalone executable. +00:21:33 So we're going to do some sort of memory management around that C is C++ ahead of time compilers. They will interpret your code, parse it and compile it down into machine code instructions, and then put it in a binary format, like a shared library or a standalone executable. -00:21:50 Net, Java and other languages that have a Git. +00:21:50 Net, Java and other languages that have a Jit. -00:21:55 They have both a compiled VM, which is something which has actually been compiled into a standard executable, which is the framework, so that the Java Exe, for example. +00:21:55 They have both a compiled VM, which is something which has actually been compiled into a standard executable, which is the framework, so that the Java.exe, for example. 00:22:07 And then it could compile down the code into an intermediary language and then evaluate that just in time and then typically cache the machine code onto a disk or into memory. -00:22:19 And it does that using a Jet and CPython interprets everything runtime essentially. +00:22:19 And it does that using a Jit and CPython interprets everything runtime essentially. -00:22:27 So it does cache the Byte code, but it doesn't catch up the machine code because it doesn't compile to machine code. +00:22:27 So it does cache the Byte code, but it doesn't cache up the machine code because it doesn't compile to machine code. -00:22:32 And that's what Pigeon does. +00:22:32 And that's what Pyjion does. 00:22:34 Right. Exactly. @@ -486,19 +484,19 @@ 00:23:10 The steps are and I do go to this in the talk. -00:23:13 But Python code abstracts and text tree code object, which has Python bytecode, and then Pigeon will basically compile Python bytecode into Net intermediary bytecode, and then net will compile the intermediary bytecode into assembly into a machine code. +00:23:13 But Python code abstracts syntax tree code object, which has Python bytecode, and then Pyjion will basically compile Python bytecode into .Net intermediary bytecode, and then .net will compile the intermediary bytecode into assembly into a machine code. 00:23:31 And then you attach that to say the function object or a class or something like that. Right. 00:23:35 Yeah. -00:23:35 And then that bitecode that machine code. Sorry, is essentially an executable which lives in memory. +00:23:35 And then that bytecode that machine code. Sorry, is essentially an executable which lives in memory. 00:23:41 And then when you want to call it, you just call that memory address and it runs the function just in the same way that you would load a shared library and just call the address. 00:23:52 Right. -00:23:52 You might have a so file and you import it and run it. And as far as you're concerned, magically, it just runs. Right. Exactly. +00:23:52 You might have a .so file and you import it and run it. And as far as you're concerned, magically, it just runs. Right. Exactly. 00:23:58 Okay. @@ -506,7 +504,7 @@ 00:24:02 Not necessarily. -00:24:03 We'll get to the performance of the overall system, but is this jet step? +00:24:03 We'll get to the performance of the overall system, but is this jit step? 00:24:07 Is this a big deal? @@ -518,11 +516,11 @@ 00:24:25 I've been really impressed. -00:24:27 Pigeon is written in C Plus plus, and the compilation steps are pretty quick. +00:24:27 Pyjion is written in C++, and the compilation steps are pretty quick. 00:24:32 The overhead is 10% to 15% of the execution time on the first pass, depending on the complexity of the function. -00:24:39 But yeah, if the function takes a second to run, then 00:15 of a second is around how much it will take to compile it. +00:24:39 But yeah, if the function takes a second to run, then .15 of a second is around how much it will take to compile it. 00:24:48 Yeah. @@ -534,15 +532,15 @@ 00:24:50 And then once it's done at once, that's it. -00:24:53 With the exception that Pigeon has a feature called Profile guided compilation, which is kind of something that I designed to get around how dynamic Python is. +00:24:53 With the exception that Pyjion has a feature called Profile guided compilation, which is kind of something that I designed to get around how dynamic Python is. -00:25:05 Jt compilers are brilliant when you've got statically Typed languages. +00:25:05 Jit compilers are brilliant when you've got statically Typed languages. 00:25:09 So if you know that this variable is an integer and this variable is a string and this variable is an object, then you can compile all the correct instructions. 00:25:17 But in Python variable, A could be assigned as a string and then change to an integer, and then you can assign it to the return of a function, which could be anything. -00:25:28 So one of the challenges I kind of looked at was how do you actually make a jet is only going to be faster if you've got optimizations, and you can't make optimizations if you have to generalize everything. +00:25:28 So one of the challenges I kind of looked at was how do you actually make a jit is only going to be faster if you've got optimizations, and you can't make optimizations if you have to generalize everything. 00:25:38 What it does is a feature called PGC, which it will compile a profiling function. @@ -576,19 +574,19 @@ 00:26:41 Yes. -00:26:42 They're called specializations, and that's something that Mark Shannon talked about. And I think when CPython does its own jet, they will definitely have specializations. +00:26:42 They're called specializations, and that's something that Mark Shannon talked about. And I think when CPython does its own jit, they will definitely have specializations. 00:26:51 The downside is extremely, and the downside is that you have a lot of memory overhead. 00:26:56 If there are lots of specializations, and a good example would be in the unit test module, the Assert equal function. -00:27:04 This is pretty much the first one I kind of slammed into, like Pigeon tried to optimize the assert equal function, which could take anything like it could take two strings, a string and a number. +00:27:04 This is pretty much the first one I kind of slammed into, like Pyjion tried to optimize the assert equal function, which could take anything like it could take two strings, a string and a number. 00:27:15 Probably. The first question is, are they the same type or can they be coerced in the same type and then just keep going down like these different cases? That can't be simple. 00:27:23 Yes. -00:27:23 And it was actually a conversation with Gido. +00:27:23 And it was actually a conversation with Guido. 00:27:26 He suggested looking at typeguards. @@ -596,7 +594,7 @@ 00:27:45 So essentially how it deals with different types. -00:27:49 Yeah. One of the false three paths could be just. +00:27:49 Yeah. One of the follow through paths could be just. 00:27:51 Well, let Python have it. @@ -606,17 +604,17 @@ 00:27:55 Yeah. -00:27:55 There are some things that Pigeon doesn't support asynchronous wait is one major major feature. +00:27:55 There are some things that Pyjion doesn't support async and await is one major major feature. 00:28:00 If it comes across asynchronous generators, then it will just hand them back to Python and Python executes them. -00:28:06 It should be in there, though, right. I mean, Csharpen. +00:28:06 It should be in there, though, right. I mean, C#. -00:28:09 Net also have asynchronous way. I know that means quite a bit differently, but theoretically, in the future, down the road when you have more time, maybe it's not completely out of the world possible. +00:28:09 .Net also have async await. I know that means quite a bit differently, but theoretically, in the future, down the road when you have more time, maybe it's not completely out of the world possible. 00:28:18 I actually kind of started implementing it and put most of it together. -00:28:22 I need to realize that the APIs for Asynchronous generators are all private in C Python, so I can't import them, which makes it technically impossible to implement, which is a bit of a shame, but yeah, that's one of the drawbacks at the moment is you can't do asynchronous wait. +00:28:22 I need to realize that the APIs for Asynchronous generators are all private in C Python, so I can't import them, which makes it technically impossible to implement, which is a bit of a shame, but yeah, that's one of the drawbacks at the moment is you can't do async and await 00:28:39 Right. But if this were super successful, I can see that. That's like, okay, well, let's go ahead and expose that because Anthony is so close. @@ -624,7 +622,7 @@ 00:28:49 It's like a one line code change. -00:28:51 I think this doesn't apply to the profile guided optimizations. But one of the things that these frameworks have, I know that Net has had it at several levels, like they've got this engine utility that will take a Net Assembly in Il, and you can pre compile it, like ahead of time, compile it and generate a native image on your machine. +00:28:51 I think this doesn't apply to the profile guided optimizations. But one of the things that these frameworks have, I know that .Net has had it at several levels, like they've got this Ngine utility that will take a Net Assembly in IL, and you can pre compile it, like ahead of time, compile it and generate a native image on your machine. 00:29:13 And then Xamarin had that because they had to have something like this to get onto iOS where they ran the J compiler in advance and saved it. @@ -686,7 +684,7 @@ 00:31:44 There are some things that happen that it can do to optimize. -00:31:48 For example, there's a list of all the built in, and it knows what return types the built in half. +00:31:48 For example, there's a list of all the built in, and it knows what return types the built-in have. 00:31:53 So for sure, like it knows if you run list as a built in function, then it will return a list. @@ -700,9 +698,9 @@ 00:32:34 If the code knows for sure that names is a list, then instead of doing calling us the API to see what it is and get the index, et cetera. -00:32:45 The Jet compiler can go, oh, I already know this is a list. I know the index you want is the fourth number. +00:32:45 The Jit compiler can go, oh, it already know this is a list. I know the index you want is the fourth number. -00:32:51 So instead of calling with the staff that just calculate the memory address of the fourth item in the list and then put in a little check to make sure that there are four items in that list and then just compile that into the function and it's immediately significantly quicker. +00:32:51 So instead of calling with the stuff that just calculate the memory address of the fourth item in the list and then put in a little check to make sure that there are four items in that list and then just compile that into the function and it's immediately significantly quicker. 00:33:08 Go to where the data is stored in the list. @@ -738,19 +736,19 @@ 00:33:49 Yeah, definitely. -00:33:49 And when you're working with Jupals, you do that as well. So you work out the address of the Nth element and then just use that address and increment the reference counter. +00:33:49 And when you're working with Tuples, you do that as well. So you work out the address of the Nth element and then just use that address and increment the reference counter. 00:34:00 Yeah. Also, don't forget that memory management break. -00:34:07 This portion of Talk Pythonomy is sponsored by Lenode. +00:34:07 This portion of Talk Python to Me is sponsored by Linode. 00:34:10 Cut. -00:34:11 Your cloud builds in half with Lenovo's Linux virtual machines, develop, deploy, and scale your modern applications faster and easier. +00:34:11 Your cloud builds in half with Linode's Linux virtual machines, develop, deploy, and scale your modern applications faster and easier. 00:34:18 Whether you're developing a personal project or managing larger workloads, you deserve simple, affordable, and accessible cloud computing solutions. -00:34:26 Get started on Lenode today with $100 in free credit for listeners of Talk Python, you can find all the details over at Talk Python FM Lenode, Lenode has data centers around the world with the same simple and consistent pricing, regardless of location, choose the data center that's nearest to you. +00:34:26 Get started on Linode today with $100 in free credit for listeners of Talk Python, you can find all the details over at TalkPython.FM/linode, Linode has data centers around the world with the same simple and consistent pricing, regardless of location, choose the data center that's nearest to you. 00:34:45 You also receive 24/7, 365 human support with no tears or handoffs. @@ -758,31 +756,31 @@ 00:34:52 Imagine that real human support for everyone. -00:34:55 You can choose shared or dedicated Compute instances, or you can use your $100 in credit on S three compatible Object Storage managed Kubernetes clusters, and more. +00:34:55 You can choose shared or dedicated Compute instances, or you can use your $100 in credit on S3 compatible Object Storage managed Kubernetes clusters, and more. 00:35:05 If it runs on Linux. -00:35:06 It runs on Lenode. +00:35:06 It runs on Linode. -00:35:08 Visit Talk bython FM and click the Create Free Account button to get started. +00:35:08 Visit Talkpython.FM and click the Create Free Account button to get started. 00:35:13 You can also find the link right in your Podcast Player show Notes. -00:35:16 Thank you to Lenode for supporting Talk Python. +00:35:16 Thank you to Linode for supporting Talk Python. -00:35:21 Where are you with this? You said it's going to go to one0, which sounds like I could install this and I could run it and it would do its magic. +00:35:21 Where are you with this? You said it's going to go to 1.0, which sounds like I could install this and I could run it and it would do its magic. -00:35:28 Right? It's going to one0 works only on Python three point ten. +00:35:28 Right? It's going to 1.0 works only on Python3.10. 00:35:32 That's one big thing. -00:35:34 Upgraded it from 3.9 to three point ten when three point ten was released, actually, and I won't be backporting. +00:35:34 Upgraded it from 3.9 to 3.10 when three point ten was released, actually, and I won't be backporting. 00:35:40 It. -00:35:40 It's just so much has changed in Python in the APIs, you can Pivot install it on Python three point ten. +00:35:40 It's just so much has changed in Python in the APIs, you can PiP install it on Python three point ten. -00:35:47 You need to have Net six installed when that is released, or you can still release Candidate two, which is already out. +00:35:47 You need to have .Net6 installed when that is released, or you can still install release Candidate two, which is already out. 00:35:55 And yes, you can enable it. @@ -796,15 +794,15 @@ 00:36:12 So. -00:36:12 Okay, that's a pretty can I brewinstall net. Do you know I've not tried? +00:36:12 Okay, that's a pretty can I brewinstall .net. Do you know I've not tried? 00:36:16 I don't know. 00:36:17 That's a good question. -00:36:18 There is an installer for that. +00:36:18 There is an installer for Mac. -00:36:19 Pigeon also works on Arm 64, which is worth noting, and it's a very complicated detail of Jack and partners. +00:36:19 Pyjion also works on Arm 64, which is worth noting, and it's a very complicated detail of J Compilers. 00:36:27 Arm support was no small feat, but it's something that people just expected to be there. @@ -844,19 +842,19 @@ 00:37:38 I'm not asking for your this is more of me just making a proclamation. -00:37:43 I have Windows Eleven running on my Mac Mini M one, and it is running the Arm, but to get it, I had to go join the Insiders program and then install it and it's permanently got this watermark, but it's a tainted version, but you can try to use it and it works fine, but it's kind of sluggish. And whatnot so anyway, hopefully that comes along better. +00:37:43 I have Windows 11 running on my Mac Mini M one, and it is running the Arm, but to get it, I had to go join the Insiders program and then install it and it's permanently got this watermark, but it's a tainted version, but you can try to use it and it works fine, but it's kind of sluggish. And whatnot so anyway, hopefully that comes along better. 00:38:04 So it sounds like it's supported on the various things. 00:38:07 I have Net Six installed and Python 310 installed. -00:38:11 Neither of those have to be messed with. Right. You've got the Pepper Python and you've got just the Jet Vanilla installations. +00:38:11 Neither of those have to be messed with. Right. You've got the Pep for Python and you've got just the Jit Vanilla installations. 00:38:19 Yeah, that's beautiful. 00:38:20 And so give us a little walkthrough on how we might use this. -00:38:23 What do I have to do to change my code to get these compilation steps wherever your code starts running and you need to import Pigeon and then call the enable function on Pigeon. +00:38:23 What do I have to do to change my code to get these compilation steps wherever your code starts running and you need to import Pyjion and then call the enable function on Pyjion. 00:38:33 Okay. @@ -908,33 +906,33 @@ 00:40:49 In terms of whether this will work, I've compiled some pretty big libraries and they've worked fine. -00:40:54 Pandas Flask Django chucked a lot of the Sea Patterns test suite this as well. +00:40:54 Pandas Flask Django chucked a lot of the CPython test suite this as well. 00:41:01 So yeah, it will run, I guess, to about 50,000 tests or something, I think quite happily. 00:41:06 Yeah. -00:41:07 A lot of C Python's tests testing specific internal things in cycling, so some of them do fail, but it's not anything that Pigeon has done. +00:41:07 A lot of C Python's tests testing specific internal things in C Python, so some of them do fail, but it's not anything that Pyjion has done. -00:41:16 And Pi test works as well. +00:41:16 And Py test works as well. 00:41:17 So yeah, there's a lot of big libraries. 00:41:21 Numpy works fine. -00:41:23 There's test for NumPy, test for Pandas, test for Flaskjango. All the stuff that I expect people to try is in there. +00:41:23 There's test for NumPy, test for Pandas, test for Flask Django. All the stuff that I expect people to try is in there. -00:41:29 If you're working with a lot of See extension modules, they also do work Slurk. +00:41:29 If you're working with a lot of C extension modules, they also do work Cyphon extensions. 00:41:34 So in terms of compatibility, that was one of the main things I wanted to focus on was instead of going super aggressive with the optimizations, I just want to make sure this works with existing code because there are lots of other projects, which right. -00:41:47 We have PyPy already PY PY, which is also a Jet compiler, and it works in not with the Net backing legit, but some of the hot functions getting compiled versus just running Python. +00:41:47 We have PyPy already PY PY, which is also a Jit compiler, and it works in not with the Net backing legit, but some of the hot functions getting compiled versus just running Python. -00:42:00 That kind of stuff is pretty similar now, but they made the big trade off. Like we're going to just go all in on compiling and we're going to not necessarily integrate with the C APIs in the same way, which means breaking with some of these things, like Numbai or Panas that people sometimes care about. Yeah. +00:42:00 That kind of stuff is pretty similar now, but they made the big trade off. Like we're going to just go all in on compiling and we're going to not necessarily integrate with the C APIs in the same way, which means breaking with some of these things, like NumPy or Pandas that people sometimes care about. Yeah. 00:42:14 And they also have to play catch up on the language features. -00:42:17 So if there's new features in 3.93 point ten in the language like new operators or whatever, then Pipe has to then go and implement that which is hard pigeon you load into C Python. So in terms of language, it would be exactly the same. +00:42:17 So if there's new features in 3.9 3.10 in the language like new operators or whatever, then PyPy has to then go and implement that which is hard Pyjion you load into C Python. So in terms of language, it would be exactly the same. 00:42:33 Right. Often a lot of those language features are just syntactic sugar over existing things. Right. @@ -946,17 +944,17 @@ 00:42:51 Awesome. -00:42:52 It looks like it works for the most part. I haven't totally tried it, but it sounds like it works quite extensively the way you use it as you Pip install Pigeon and then just import Pigeon. Pigeon enable is option one, and then that's it. Right. There's nothing else that you have to do. +00:42:52 It looks like it works for the most part. I haven't totally tried it, but it sounds like it works quite extensively the way you use it as you Pip install Pyjion and then just import Pyjion. Pyjion enable is option one, and then that's it. Right. There's nothing else that you have to do. -00:43:06 Nothing else you have to do. You just run the person code and it all just automatically spot stuff that it should compile and compile it for you. +00:43:06 Nothing else you have to do. You just run the Python code and it all just automatically spot stuff that it should compile and compile it for you. -00:43:14 Fantastic. And then another option I see on the page here is I can say Pigeon space some Python file and not necessarily modify the file, but tell it to execute. +00:43:14 Fantastic. And then another option I see on the page here is I can say Pyjion space some Python file and not necessarily modify the file, but tell it to execute. -00:43:23 What does it do? Import Pigeon Pigeon enable Eval. +00:43:23 What does it do? Import Pyjion Pyjion.enable Eval. 00:43:31 Yeah. Basically, it's a very small script. -00:43:34 So. Yeah, pigeon is a standalone command that you can run instead of running Python, you run Pigeon against a script or a module, and all the arguments should work as normal. +00:43:34 So. Yeah, Pyjion is a standalone command that you can run instead of running Python, you run Pyjion against a script or a module, and all the arguments should work as normal. 00:43:45 Awesome. @@ -964,7 +962,7 @@ 00:43:48 Yes. -00:43:49 If you want to run a script, then you'd run Pigeon and then the name of the script. If you want to run a module like Pytest, for example, then you would do Pigeon Pytest and it would run Pytest with the Jet enabled. +00:43:49 If you want to run a script, then you'd run Pyjion and then the name of the script. If you want to run a module like Pytest, for example, then you would do Pyjion dash M Pytest and it would run Pytest with the Jit enabled. 00:44:01 Yeah. Fantastic or Flask or something like that, right? @@ -980,7 +978,7 @@ 00:44:20 So when I run my regular Python code, it just loads up and runs. -00:44:25 But when I run Flask or Fast API or Django or Pyramid or whatever, there's all sorts of layers of indirection or layers of not directly running it right in production. You would say, hey, I want Micro Whiskey or G Unicorn to run this. Like for Fast API would be I want G Unicorn to run this, but with UV according workers and run five of them. And like, boom, boom, boom. Now you've described this chain of events, right? +00:44:25 But when I run Flask or Fast API or Django or Pyramid or whatever, there's all sorts of layers of indirection or layers of not directly running it right in production. You would say, hey, I want Micro Whiskey or G Unicorn to run this. Like for Fast API would be I want G Unicorn to run this, but with UV acorn workers and run five of them. And like, boom, boom, boom. Now you've described this chain of events, right? 00:44:50 Yes. @@ -988,7 +986,7 @@ 00:44:55 Still. -00:44:55 Yeah. It's Whiskey middleware that is for Pigeon, which will do the enabling and disabling fantastic required. +00:44:55 Yeah. It's Whiskey middleware that is for Pyjion, which will do the enabling and disabling fantastic required. 00:45:03 So that sounds like it works for any Whiskey app, Jingo Pyramid, et cetera. @@ -1008,11 +1006,11 @@ 00:45:35 Exactly. -00:45:36 It also depends on the nature of the program as to where the pigeon is actually going to make a difference to their performance. +00:45:36 It also depends on the nature of the program as to where the pyjion is actually going to make a difference to their performance. -00:45:42 So kind of where I'm up to at the moment is different benchmarks and running pigeon against some standard benchmarks. +00:45:42 So kind of where I'm up to at the moment is different benchmarks and running Pyjion against some standard benchmarks. -00:45:52 I showed that n body execution time at my PyCon talk, and that was 33% faster. +00:45:52 I showed that N- body execution time at my PyCon talk, and that was 33% faster. 00:45:59 It's now 65% faster. So I've doubled that. @@ -1044,7 +1042,7 @@ 00:47:09 Yeah. You get funny overflows and stuff. -00:47:11 So one of the challenges I've had with pigeon is trying to optimize integers, but trying to understand where it potentially could be a very big number. +00:47:11 So one of the challenges I've had with Pyjion is trying to optimize integers, but trying to understand where it potentially could be a very big number. 00:47:21 And the number is like five, what's, five times five? @@ -1054,17 +1052,17 @@ 00:47:32 So that's one of the challenges. -00:47:33 If you're working with integers and you're working with floating board numbers and you do a lot of math and pigeon will make a dramatic difference. +00:47:33 If you're working with integers and you're working with floating board numbers and you do a lot of math and Pyjion will make a dramatic difference. 00:47:39 Fantastic. -00:47:40 There's also a feature called The Graph, which will create graph files for the functions that it's compiled. +00:47:40 There's also a feature called The Graph, which will create graphics files for the functions that it's compiled. 00:47:49 And you can see this on the website. -00:47:51 If you go to live, trypigeon. +00:47:51 If you go to live.trypyjion.com. -00:47:53 Com, you've got this interactive live website, right? Yeah. +00:47:53 You've got this interactive live website, right? Yeah. 00:47:56 So I kind of made a sort of Live demo site where you can type Python code in and click compile, and then it will show you, I don't change it. Michael, you broke it. @@ -1098,13 +1096,13 @@ 00:48:38 This instruction graph gets generated. -00:48:41 If you enable graphing, it's on the documentation. But when you enable graphing, it will show you all the Python by codes, and then what values are being sent between those by codes. +00:48:41 If you enable graphing, it's on the documentation. But when you enable graphing, it will show you all the Python byte codes, and then what values are being sent between those by codes. 00:48:52 This is basically the Alpha profiler you can see here that you've got A and B B with a float. 00:48:59 A is an integer, and then it's doing a multiplication operation, and it knows that if you multiply a float by an integer, then the output is a float. -00:49:07 So it carries that value through the graph pipe. Actually does things quite similar to this. +00:49:07 So it carries that value through the graph. PyPy Actually does things quite similar to this. 00:49:12 And then once the profiler has run, it will look at the graph and then make some decisions about which values don't need to be Python objects. @@ -1180,11 +1178,11 @@ 00:52:17 Yeah. -00:52:18 So the areas where Python is faster as numerical work, similar to pipe pipe is a lot faster. With numerical work, it can make clear and simple assumptions. +00:52:18 So the areas where Python is faster as numerical work, similar to PyPy PyPy is a lot faster. With numerical work, it can make clear and simple assumptions. 00:52:28 And optimize based on the CPU. -00:52:30 That's brilliant areas where it's not faster or sometimes even slower is code, which just uses a lot of classes and very small functions, partly just because of the way the purpose designed it will jet compile functions. +00:52:30 That's brilliant areas where it's not faster or sometimes even slower is code, which just uses a lot of classes and very small functions, partly just because of the way the purpose designed it will jit compile functions. 00:52:48 And if your functions are just working with custom classes and you're passing things around, then trying to decide what type things are and then how it can optimize types. @@ -1202,7 +1200,7 @@ 00:53:25 It's been set. It's not none. -00:53:27 Like if you Jango by the time you're done testing them all. +00:53:27 Like if you DJango by the time you're done testing them all. 00:53:30 You might as well just run it. @@ -1210,7 +1208,7 @@ 00:53:36 But the difference is that if you JIT compile it, you've got to emit all those instructions and the compiled function. -00:53:42 The Jet compiled function ends up being bigger, because if it's compiled in C, it just has one function that does that shared by all libraries, whereas in the gym, you have to make it so that it's their standalone functions. +00:53:42 The Jit compiled function ends up being bigger, because if it's compiled in C, it just has one function that does that shared by all libraries, whereas in the gym, you have to make it so that it's their standalone functions. 00:53:56 So that's one downside is that if you're working with stuff, which is similar to Django and Flask, I guess like lots of classes, lots of variables which are all custom types. @@ -1220,11 +1218,11 @@ 00:54:10 Will it be transitive? -00:54:11 If I write code that runs in Flask, let's just pick one of them and I run Flask with pigeon. Will that then make all my code that Flask is executing also run in pigeon. Yeah. So maybe if I was doing, like, highly computational stuff in my Flask app, having to do that might be worthwhile. +00:54:11 If I write code that runs in Flask, let's just pick one of them and I run Flask with Pyjion. Will that then make all my code that Flask is executing also run in Pyjion. Yeah. So maybe if I was doing, like, highly computational stuff in my Flask app, having to do that might be worthwhile. 00:54:29 Yeah, definitely. -00:54:30 And in that case, you can just enable Pigeon before those functions, or you can set the threshold to be higher. +00:54:30 And in that case, you can just enable Pyjion before those functions, or you can set the threshold to be higher. 00:54:36 That's what makes more sense. @@ -1232,7 +1230,7 @@ 00:54:40 So if you're doing a lot of work with strings, I haven't done any work on optimizing strings, and I'm not particularly sure what you would optimize either, because they're so complicated. -00:54:52 You're dealing with all the Unicode, different encodings, different butt links. +00:54:52 You're dealing with all the Unicode, different encodings, different back links. 00:54:57 I don't even know how you would improve upon C Python string implementation. @@ -1266,7 +1264,7 @@ 00:56:15 Yeah. -00:56:15 I've kind of documented them as best I can on the Pigeon documentation. There's a section called Built in Optimizations, and I've given them all numbers. +00:56:15 I've kind of documented them as best I can on the Pyjion documentation. There's a section called Built in Optimizations, and I've given them all numbers. 00:56:23 And if it uses that optimization, it will flag the function to say, oh, I'd use this optimization on this function. @@ -1286,7 +1284,7 @@ 00:56:50 Yeah, it is none. -00:56:51 Then it won't run the Pi Is function. +00:56:51 Then it won't run the Py Is function. 00:56:55 It won't run the C API to do an Is comparison. It will just look at the address of both objects and see if they're the same. @@ -1318,7 +1316,7 @@ 00:57:50 Exactly. -00:57:50 So if something equals equals 25, Pigeon will go. Oh, well, I know 25 is an intern numbers, so I'm actually just going to do a point of comparison instead of a value comparison if the left hand side is a number, so that there's a bit like little things like this, which makes small differences, but when you add up, they add up. +00:57:50 So if something equals equals 25, Pyjion will go. Oh, well, I know 25 is an intern numbers, so I'm actually just going to do a point of comparison instead of a value comparison if the left hand side is a number, so that there's a bit like little things like this, which makes small differences, but when you add up, they add up. 00:58:09 Right. @@ -1334,11 +1332,11 @@ 00:58:28 So. Yeah. -00:58:29 This is one area where I was hoping that the research that I was doing whilst writing Pigeon could contribute to other projects. +00:58:29 This is one area where I was hoping that the research that I was doing whilst writing Pyjion could contribute to other projects. -00:58:36 And I've been talking to Carl Friedrick Ash as well, who works on Pipe, and we're going to do some pair programming at some point to see kind of like how different projects work and stuff like that. +00:58:36 And I've been talking to Carl Friedrick bosh as well, who works on Pypy, and we're going to do some Py programming at some point to see kind of like how different projects work and stuff like that. -00:58:50 But hopefully these optimizations can be learnt from and then used when CPI gets to implementing its jets. +00:58:50 But hopefully these optimizations can be learnt from and then used when CPI gets to implementing its jit. 00:58:59 Surely the Net compiler has all sorts of optimizations in it. @@ -1354,11 +1352,11 @@ 00:59:13 And I've been working with the compiler team on the Net project as well. -00:59:18 Pigeon is one of the only projects to use the compiler directly. +00:59:18 Pyjion is one of the only projects to use the compiler directly. 00:59:23 Even that can be used in that way. -00:59:27 I think it's designed to be run directly, but it's not like Advertisement off the shelf yet. +00:59:27 I think it's designed to be run directly, but it's not like advertisement off the shelf yet. 00:59:33 So yeah, there aren't many projects that are using it in that way, and I do work with the compiler team specific test cases and stuff as well. @@ -1378,21 +1376,21 @@ 01:00:07 I think we pretty much have covered it, given the time that we got. I mean, another area that's interesting is how does it compare to the other things that have been done before it or going along a parallel? And you do have a whole section to read me on the GitHub page. -01:00:22 How does this compare to X-Y-Z, pipe piston number, iron Python and so on? +01:00:22 How does this compare to X-Y-Z, pypy piston number, iron Python and so on? 01:00:29 Do you want to maybe just have a quick statement about that? Yeah. -01:00:31 I think it's really hard to compare them, so probably the most obvious ones to compare it with would be Cyphen number. +01:00:31 I think it's really hard to compare them, so probably the most obvious ones to compare it with would be Siphon number. -01:00:38 And Pipe. +01:00:38 And Pypy. -01:00:40 Pipe is a Python interpreter that has a jet, so it interprets compiles and runs Python code written in Python pipeline has been around it's like a fork of Python that was rewritten to behave differently rather than Pep five, two, three. Right. +01:00:40 Pipe is a Python interpreter that has a jit, so it interprets compiles and runs Python code written in Python pipeline has been around it's like a fork of Python that was rewritten to behave differently rather than Pep 523. Right. 01:00:55 Yeah. Exactly. -01:00:58 Pipe is written in Python and probably significantly faster in many cases. +01:00:58 Pypi is written in Python and probably significantly faster in many cases. -01:01:06 It's a very mature project, but obviously that there's limitations around C APIs, and some things don't work in Pipe jet specific for NumPy. +01:01:06 It's a very mature project, but obviously that there's limitations around C APIs, and some things don't work in Pypy jit specific for NumPy. 01:01:19 If you're using NumPy, then if you use number, can JIT compile, NumPy, data arrays and stuff like that, that's actually very specific use case. @@ -1400,7 +1398,7 @@ 01:01:35 It would make very little, if any difference at all. -01:01:37 And then Siphon is not compiler, and it's a way of annotating Python code with concrete types, and then it compiles them into C. Concrete, compiles them into C extensions. +01:01:37 And then Syphon is not compiler, and it's a way of annotating Python code with concrete types, and then it compiles them into C. Concrete, compiles them into C extensions. 01:01:51 Yeah. It's a little bit like what you're talking about, trying to understand what are these types? And then can we create a specialization? @@ -1412,9 +1410,9 @@ 01:02:02 That's the point where you actually specify the length of the integer as well. So in Siphon, you would say this is a 64 bit integer so that it knows that it can be converted into a 64 bit integer. In C. -01:02:15 Pigeon is probably closest to Siphon. +01:02:15 Pyjion is probably closest to Siphon. -01:02:17 Obviously, with Siphon, you have to compile it to a C extension ahead of time, whereas the pigeon you just import it into Python and just turn it on and it just runs and compiles live, and it will. +01:02:17 Obviously, with Siphon, you have to compile it to a C extension ahead of time, whereas the Pyjion you just import it into Python and just turn it on and it just runs and compiles live, and it will. 01:02:28 Yes. You don't have to have different compiled versions of your app or your library. @@ -1430,25 +1428,25 @@ 01:02:54 We've had these type annotations, and traditionally they've meant nothing, right? -01:02:59 Except for if you run tools against them. On the other hand, we've had things come along like gigantic like Fast API that look at that and go, you know what? I'm going to do something with that because I got a string because this is the web, and that's all I usually get. +01:02:59 Except for if you run tools against them. On the other hand, we've had things come along like Pydantic like Fast API that look at that and go, you know what? I'm going to do something with that because I got a string because this is the web, and that's all I usually get. 01:03:10 I'm going to make that into an it because you said it's an end. -01:03:13 Is there a scenario where type invitations play into this to enhance it? +01:03:13 Is there a scenario where type annotations play into this to enhance it? 01:03:18 Somehow I'm against that idea. -01:03:20 Potentially, that's how cycling works, and with type annotations as well. +01:03:20 Potentially, that's how Cython works, and with type annotations as well. 01:03:26 Having a type checker is great until the types are wrong, and it's not a fault of your own. -01:03:33 And having worked on, like, strongly type languages like C Sharp, C Sharp is brilliant, except when you need to do things like reflection. +01:03:33 And having worked on, like, strongly type languages like C#, C# is brilliant, except when you need to do things like reflection. -01:03:42 So let's say you're working with Jason, which like Jason Data or YAML, for example. +01:03:42 So let's say you're working with Json, which like Jason Data or YAML, for example. -01:03:48 And working with Jason and YAML in Csharp is incredibly hard because you're like, I've had to do parsing YAML files in Java. +01:03:48 And working with Json and YAML in C# is incredibly hard because you're like, I've had to do parsing YAML files in Java. -01:04:00 It's incredibly difficult because you're like, oh, well, this could be a list of strings, or it could be a dictionary where the key is a string, or sometimes it's a number which is like Gamma is like that sometimes. +01:04:00 It's incredibly difficult because you're like, oh, well, this could be a list of strings, or it could be a dictionary where the key is a string, or sometimes it's a number which is like YAML is like that sometimes. 01:04:14 And JSONs like that is completely free. So when you're working with dynamic content, using strongly type languages is extremely difficult. @@ -1494,9 +1492,9 @@ 01:06:01 Let me throw one quick thing out there before you pass final judgment on this type thing, because you're right. -01:06:08 I could write a thing that says my function takes an Int and a string, and I could run my pie against my code. And sure enough, it only takes ends and strings in these situations. But if it's a library, all bets are off. +01:06:08 I could write a thing that says my function takes an Int and a string, and I could run MyPy against my code. And sure enough, it only takes ends and strings in these situations. But if it's a library, all bets are off. -01:06:20 There's nothing that says people who use your library are going to run my pie and listen to that or do anything right. They could write notepad if they had no self respect. But that was like you could write whatever you want, right. And then you could just feed it on and then you'd have these problems that said, over on the Pygmtic world, there is a validator decorator called at validate arguments that will make sure at runtime they really are stringing an end. +01:06:20 There's nothing that says people who use your library are going to run MyPy and listen to that or do anything right. They could write notepad if they had no self respect. But that was like you could write whatever you want, right. And then you could just feed it on and then you'd have these problems that said, over on the Pydantic world, there is a validator decorator called at validate arguments that will make sure at runtime they really are stringing an end. 01:06:47 Yes. @@ -1536,7 +1534,7 @@ 01:08:01 Once you kind of open. I think that once you open custom types, then it just kind of mushrooms into this. -01:08:07 Sure and that's why you see things like Python and stuff having like little fragments of here's some limited code that we're going to use often fundamental types. +01:08:07 Sure and that's why you see things like Cython and stuff having like little fragments of here's some limited code that we're going to use often fundamental types. 01:08:17 All right, Anthony, this is really awesome. @@ -1550,23 +1548,23 @@ 01:08:37 So if you're going to write some code, what editor are using these days vs code right on. Yeah. -01:08:43 And notable IPI library. +01:08:43 And notable PyPi library. -01:08:46 It could be pigeon. +01:08:46 It could be Pyjion. 01:08:47 Anything else like you come across like, wow, this is awesome. 01:08:50 Yeah, I think I mentioned it before. -01:08:52 Tortoise I'm a big fan of at the moment. +01:08:52 Tortoise ORM I'm a big fan of at the moment. -01:08:53 Yeah. Tortoise, RM. +01:08:53 Yeah. Tortoise, ORM. -01:08:55 It's a nice async RM and Beanie as well. I really enjoy playing with Beanie. Is an ODM ODM on top of Mongo. +01:08:55 It's a nice async ORM and Beanie as well. I really enjoy playing with Beanie. Is an ODM and async ODM on top of Mongo. 01:09:04 Yes, beanie is very cool. I'm actually having Roman Wright on the show talking about Beanie not too far out as well. -01:09:10 And Beanie is cool because it's basically Pygantic plus asynchronously on top of MongoDB, which is cool. +01:09:10 And Beanie is cool because it's basically Pydantic plus async and await on top of MongoDB, which is cool. 01:09:15 Can I have three? @@ -1586,7 +1584,7 @@ 01:09:43 Got it. -01:09:44 It is a dictionary attack tool for Postgres my SQL and Ms SQL. Microsoft SQL Server designed for internal testing. +01:09:44 It is a dictionary attack tool for Postgres MySQL and My SQL. Microsoft SQL Server designed for internal testing. 01:09:53 Of course. @@ -1600,11 +1598,11 @@ 01:10:05 See if an admin has a login like password, password one or admin or super user as a login or whatever. -01:10:12 Yeah, it was also a test of, I think in a way, networking and how fast I could make it. +01:10:12 Yeah, it was also a test of,async and await, networking and how fast I could make it. 01:10:17 I can do up to 120 login attempts a second. -01:10:21 So yeah, on my machine. But maybe this is a four call match, but if you had a few more CPUs, you could probably get a bit more than that. +01:10:21 So yeah, on my machine. But maybe this is a four core match, but if you had a few more CPUs, you could probably get a bit more than that. 01:10:30 But yeah, it goes through a few thousand passwords and there's a password listing as well of about 10,000 common database passwords. Yeah. Nice. @@ -1626,19 +1624,19 @@ 01:11:04 It's awesome to have you back on the show and Congratulations on the work here. -01:11:09 Final call to Action people. Maybe to try Pigeon. You want them to contribute? +01:11:09 Final call to Action people. Maybe to try Pyjion. You want them to contribute? 01:11:13 Got other ideas. 01:11:14 What do you say? Yeah. -01:11:15 Go to trypigeon. +01:11:15 Go to trypyjion.com -01:11:16 Com. +01:11:16 -01:11:17 Yes, on Try pigeon. +01:11:17 Yes, on Try Pyjion.com. -01:11:18 Com. You'll see at the top, you can try that. Live links to documentation, links to download. +01:11:18 You'll see at the top, you can try that. Live links to documentation, links to download. 01:11:24 Yes. I'd love more contributions or discussion. I think around what optimizations you could have and people using it and checking it out. @@ -1660,35 +1658,35 @@ 01:11:50 Be sure to check out what they're offering. It really helps support the show. -01:11:53 Choose Shortcut formerly Clubhouse I O for tracking all of your project's work because you shouldn't have to project manage your project management, visit Hockpython FM Shortcut. +01:11:53 Choose Shortcut formerly Clubhouse.IO for tracking all of your project's work because you shouldn't have to project manage your project management, visit Talkpython.FM/Shortcut. -01:12:04 Simplify your infrastructure and cut your cobbles in half with Lino's Linux virtual machines. +01:12:04 Simplify your infrastructure and cut your cloud bills in half with Linode's Linux virtual machines. 01:12:09 Develop, deploy and scale your modern applications faster and easier. -01:12:13 Visit Talk bythonfamilynode and click the Create Free Account button to get started. +01:12:13 Visit Talkpython.fm/linode and click the Create Free Account button to get started. 01:12:18 Do you need a great automatic speech to Text API? 01:12:21 Get human level accuracy in just a few lines of code? -01:12:23 Visit Talkpython FM AssemblyAI when you level up your Python, we have one of the largest catalogs of Python video courses over at Talk Python. +01:12:23 Visit 'Talkpython.FM/AssemblyAI'. Want you level up your Python, we have one of the largest catalogs of Python video courses over at Talk Python. 01:12:32 Our content ranges from true beginners to deeply advanced topics like memory and async and best of all. -01:12:38 There'S not a subscription in site. +01:12:38 There's not a subscription in site. -01:12:40 Check it out for yourself at Training Talkpython FM be sure to subscribe to the show, open your favorite podcast app and search for Python. +01:12:40 Check it out for yourself at 'Training.Talkpython FM' be sure to subscribe to the show, open your favorite podcast app and search for Python. 01:12:48 We should be right at the top. -01:12:49 You can also find the itunes feed at itunes, the Google Play feed at Slashplay and the Direct RSS feed at slash. +01:12:49 You can also find the itunes feed at /itunes, the Google Play feed at /play and the Direct RSS feed at -01:12:56 Rss on Talk Python FM. +01:12:56 /Rss on Talk Python FM. 01:12:59 We're live streaming most of our recordings these days. -01:13:02 If you want to be part of the show and have your comments featured on the air, be sure to subscribe to our YouTube YouTube channel at Talkpython FM. +01:13:02 If you want to be part of the show and have your comments featured on the air, be sure to subscribe to our YouTube channel at Talkpython.FM/ 01:13:09 Youtube. @@ -1698,4 +1696,4 @@ 01:13:13 I really appreciate it. -01:13:14 Now get out there and write some Python code. \ No newline at end of file +01:13:14 Now get out there and write some Python code.