Chris Lattner
๐ค SpeakerAppearances Over Time
Podcast Appearances
I don't want to break the old thing though.
And so the typical way of handling this kind of stuff before is if you're talking about C++ templates or you're talking about C with macros, you end up with if-defs.
You get all these weird things get layered in, make the code super complicated.
And then how do you test it?
It becomes this crazy complexity, multidimensional space that you have to worry about.
And that just doesn't scale very well.
Yeah, so it can even do more, but we'll get to that.
Yeah.
So first of all, when we say that, we're talking about what's called CPython.
It's the default Python that everybody uses.
When you type Python 3, that's typically the one you use, right?
CPython is an interpreter.
And so interpreters, they have an extra layer of bytecodes and things like this that they have to go read, parse, interpret, and it makes them kind of slow from that perspective.
And so one of the first things we do is we move to a compiler.
And so just moving to a compiler, getting the interpreter out of the loop is 2 to 5 to 10x speedup, depending on the code.
So just out of the gate, just using more modern techniques.
Now, if you do that, one of the things you can do is you can start to look at how CPython started to lay out data.
And so one of the things that CPython did, and this isn't part of the Python spec necessarily, but this is just sets of decisions, is that...
If you take an integer, for example, it'll put it in an object.
Because in Python, everything's an object.