3 ms·
> Granted what messes up Python, or better said CPython implemenation, is that C extensions are allowed to mess up with its internals thus making void many poss
by vidarh 1y ago
> Granted what messes up Python, or better said CPython implemenation, is that C extensions are allowed to mess up with its internals thus making void many possible optimizations that would be otherwise available.
I'm doing a Ruby compiler (very, very slowly, though faster again now with Claude Code doing most of the heavy lifting), and the same issue with Ruby has made me seriously toy with the idea of one day embedding a C compiler so that the Ruby compiler can optimise across both (it'd still have to deal with linking to third party C code, of course, which is one reason I'm hesitating) as a simple not-so-optimizing C compiler is like a trivial toy compared to compiling Ruby where just the parser makes you want to claw your eyes out, but it'd at least widen the surface a bit.
- pjmlp 1y agoHave you seen how TruffleRuby makes use of LLVM bitcode, to ship C compiler as well?
- vidarh 1y agoI haven't, but not surprised given some of the very aggressive (in a good way) things they've done to address performance. It's impressive. I spoke to Chris Seaton back when it was getting started, and loved many of the things they were doing. Personally I want something leaner, and self-hosting, but that's also why mine is still experimental and wildly incomplete and TruffleRuby works for a lot of things.
- pjmlp 1y agoHere, I don't know all the details, just remember having seen some talks about this in the past. It builds on top of this effort, https://medium.com/graalvm/graalvm-llvm-toolchain-f606f995bf https://medium.com/graalvm/graalvm-llvm-toolchain-f606f995bf "From Interpreting C Extensions to Compiling Them" https://eregon.me/blog/assets/research/from-interpreting-c-extensions-to-compiling-them.pdf https://eregon.me/blog/assets/research/from-interpreting-c-e...
- vidarh 1y agoThanks, will definitely give it a read.