5 ms·
How I developed a faster Ruby interpreter (2022)
- sparker72678 3y ago(2022)
- dang 3y agoAdded. Thanks!
- irq-1 3y agoAuthor is Vladimir Makarov creator of MIR: "a universal lightweight Just-in-Time (JIT) compiler known as MIR. The cornerstone of the project is a machine-independent medium-level intermediate representation (MIR)." https://github.com/vnmakarov/mir https://github.com/vnmakarov/mir https://en.wikipedia.org/wiki/Intermediate_representation https://en.wikipedia.org/wiki/Intermediate_representation
- Conscat 3y agoI got excited thinking there was a new article about MIR, but this is an old post.
- wiseowise 3y ago> YJIT was initially written in C but was rewritten in Rust to simplify the porting of YJIT to new architectures. Curious. Why is that?
- norman784 3y agoI don't remember exactly all the details, but the issue was something with developing for multiple platforms, with Rust you have traits, so it's easier to implement platform specific stuff with them, with C I don't know if there's anything similar, also you can think of all the other benefits that Rust brings. From my experience once you learn Rust, it is very easy to build things and being confident that if it compiles it works, I think C also scares a lot of developers and it's harder to collaborate, because each code review must be carefully review by having a mental model of the entire app, while in Rust obviously that's the job of the compiler.
- djbusby 3y agoWith C its macros and #define blocks. Not that fun.
- fsckboy 3y agowith C people choose to use macros and define blocks because they want to, but it doesn't have to be done that way if you don't think that's fun. (Pushing back on choice of "fun"ness) Macros and define blocks turn into C code anyway. I think those header files festooned with ifdef's are a nightmare, and it's the wrong choice, a type of premature optimization.
- djbusby 3y agoI'm familiar with various methods - and also what we observe in the wild across many FOSS projects. The #define, #ifdef, macro method is in the majority of what I see. And the examples of the "right way" are harder to find (now I wonder what GPT would suggest). None of those methods are fun for me anymore :(
- fsckboy 3y agoI was simply pointing out that complaining about the C preprocessor is not complaining about C. You don't have to use the C preprocessor, you can do what it does in C, because that's what it does.
- tendto 3y agoI agree it's possible to use C. Arguably C still lacking a better way of including files is a limitation of C as a language instead of only a complain on the preprocessor.
- unwind 3y agoJust to add some clarification, I think what you mean is that one alternative way is to split implementations apart where necessary, and have separate translation units for various targets. That can lead to a cleaner implementation without conditional compilation (or with conditional compilation restricted to picking the right files). What other method(s) were you thinking of?
- Veliladon 3y agoShopify have a full rundown on it here: https://shopify.engineering/porting-yjit-ruby-compiler-to-rust https://shopify.engineering/porting-yjit-ruby-compiler-to-ru...