I'll have to pick up a copy of this "Ruby Under a Microscope" book when the new version comes out. I've always liked Ruby, I just haven't had much chance to use it.
I dropped OSX long ago, so can't even try it out any more.
I wonder how much of the LLVM bits could be reused? I'm sure LLVM's changed a bunch in the last 15 years, too.
This sounds like Microsoft when they moved from VB6 to VB.Net. At least they have a good thing going with C# though.
VB6 was quite an interesting beast. You could do basically everything that you could do in languages like C/C++, but in most cases, you could churn out code quicker. This even extended to DirectX/Direct3D! For Web pages? ASP Classic.
The tl;dr is that I really wish that ease of development were prioritized along with everything else. One of the reasons I like Ruby is the elegance of the language and ease of using it.
Note that I've been using it since the mid 2000s or so, but not exclusively (both it and VB6 defined my career, however). C# is my second most favorite.
If Ruby had the GUI design tools VB6 had, it would be interesting to look at the popularity stats
Anyway, I'm rambling, so there is that. ;)
I do agree it'd be interesting to have a GUI designer for Ruby. Does QML paired with QtRuby work?
In the distant past I had a book about FXRuby, but never used it much, and don't think it had a UI designer - it was just bindings to Fox Toolkit, which is lightweight, but not as well maintained as Qt or Gtk.
> You could do basically everything that you could do in languages like C/C++
As long as there is some form of memory access, any language can do basically everything that one can do in C/C++, but this doesn't make much sense.
No VB6 had really easy COM integration which let you tap into a lot of Windows system components. The same code in C++ often required hundreds of lines of scaffolding, and I'm not exaggerating
You might get destroyed for this? Why?
I don’t know what either of those mean in this context, and I used VB6 for a couple years at least and have been programming ObjC and / or Swift since 2006, with some time in Rails over a couple years.
I’m extremely confused by your comment, it’s apparently near verboten in polite company, yet, manages to say nothing other than that while invoking several things of which I’m quite familiar.
If you are destroyed, I anticipate it will be for a quarter baked, horrible, analogy between ObjC/Swift (or is it Ruby/Swift)? and VB6/VB.NET that somehow has something to do with Ruby.
0 - https://www.goodreads.com/book/show/624316.Enterprise_Integr...
I haven't kept up with the evolving Ruby implementation internals, so I will sure as heck buy this new version of the book.
And by what process is the correct compiled block used depending on the input variable types?
This basic algorithm is called "Basic Block Versioning." Maxime Chevalier-Boisvert from Shopify has some great presentations online about this; for example [1].
I believe ZJIT, the newer JIT engine, uses a different approach. I'm exploring that now.
[1] https://www.youtube.com/watch?v=zO9_uTaELCw — RubyConf 2021 - YJIT - Building a new JIT Compiler inside CRuby by Maxime Chevalier Boisvert.
https://sorbet.org/blog/2021/07/30/open-sourcing-sorbet-comp...
At first glance this seems too simple. Compare it to JavaScript JITs, which IIRC can compile hot spots even in functions that are only called a few times (e.g. those that contain heavy loops) via on-stack replacement. (Although I’ve also heard on-stack replacement called a “party trick” - more useful for optimising benchmark scores than for real code.)
But on the other hand, Ruby’s language design might help here. Idiomatic Ruby uses blocks for loop bodies - so can Ruby JITs optimise long-running loops by treating the loop body as just another function?
Yes that's something I want to dig into and explore in this chapter... when exactly does Ruby's JIT compiler activate and optimize our code? And you're right: since Ruby will JIT blocks as if they were separate function many loops will be optimized using this simple heuristic.
I haven't used it in about 10 years
Compared to itself from 10 years ago I think it's made great progress. Can't put a number to it but I wouldn't be surprised if it's 2x or 3x faster, especially with the "new" JIT (YJIT) enabled. The JIT comes with a memory usage penalty though. You can see some benchmarks over time (although not going back as far as 10 years) at https://speed.ruby-lang.org
1: https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
I did recent testing that showed it to be faster than Python but slower than Lua: Lua, Ruby and Python ran my benchmark in 12, 18 and 25 seconds respectively.
This was measured using the latest versions of each language (5.4, 3.4 and 3.13), using only the interpreters, no JITs.
> I haven't used it in about 10 years
It looks like the relative performance of the three languages hasn't changed much since I did a similar benchmark with Ruby 2.0, about that long ago.
So it's "fast". There's plenty more that can be done to make it much faster still, but even before yjit, MRI had gotten pretty decent.