Hey, folks, welcome back to the Ruby Dev Summit. I am your
host, Charles Maxwood, and we are going to talk a little bit about
the Ruby programming which language today. Now we've talked about community, We've talked
about the learning resources and media resources. We've talked about all kinds of different
things coming in the Ruby programming language as far as what platforms that can run
on. And now let's just dive into the language itself, right and so
there are a whole bunch of things that have come out lately with the Ruby
three dot three and three dot two. I think the thing that most people
are most excited about are just the performance upgrades that come with Ruby. So
let's talk about a few of those. One of the biggies is actually the
justin time compiler or the JIT. You'll hear people talk about wy jit.
That's the justin time compiler that is built into Ruby. Incidentally, I just
installed Ruby three dot three on my machine and it kept failing, so I
had to figure out what the problem was. It turns out you need Rust
to compile Ruby these days, so that's just a heads up if you're getting
into that. But it's pretty hard fast, so I'm pretty happy with that.
It's it's awesome, but yeah, diving in. So what is a
JIT? What is adjusting a time compiler? Well, I put out a
short on some of the Ruby rogues extras where I talked about what a JIT
or just a time compiler is. But effectively, what it does is it
takes stuff that you run a lot in Ruby and it compiles it down to
machine language so that it can actually run it faster every time it runs.
It's right. So let's say that you're running through a loop and you're going
to run through it a million times after the first I don't know, a
few hundred times I think it is, it'll actually pick that loop up and
it'll compile it down so that it can run it natively on your machine,
kind of like Sea and Rust and those kinds of languages do it, which
is way cool and it makes it way faster. So that's just one thing
to keep in mind. Now the GIT is turned on, you can turn
it on with a flag and Ruby three two you can turn it on at
run time in three dot three And so if you want to run it,
or if you are using a gem or language or framework or something like that
that decides that it wants or needs it, then it can actually turn it
on for you if you're running Ruby three three And it looks like some of
the more upcoming versions of rails are going to actually take advantage of that turn
it on. So pretty excited about that. That's cool stuff. Another thing
that we talked about is the parser, the Prison parser. I couldn't get
Kevin Newton to come. There was some deal with making sure that it worked
out for his work, and there just wasn't enough time to make them comfortable
with him doing an interview. So but yeah, he's been writing a whole
bunch of stuff on his blog and anyway, just just awesome, awesome stuff
coming out with the prison parser. Apparently it's faster, it's cleaner, it
does a whole bunch of stuff, and it's more fault tolerant, which means
that if you write syntax problems into your Ruby code, it will pick them
up and it handles them better. But what's really interesting about the prison parser
in particular is that it is a parser that can be used for other projects
like Opal or Ruby WOSM or Truffle Ruby or some of the other Ruby interpreters.
Out there, right, And so if you're running Ruby, that's not
Ruby Ruby, maybe it's j Ruby. Right. All of these languages can
take advantage of it and pars in a nice, clean, awesome, automated
way. But another thing that comes out of it is that one of the
things that we use Ruby for fairly often on our development machines is programming language
services. So, for example, if you're using visual Studio code or Ruby
Mine or something like that, then it actually runs Ruby on the side,
and it is consistently talking to that Ruby VM and making sure that the stuff
that you send to it is valid Ruby. And so that's why you get
the little syntax highlighting, the little I don't know what it is, a
little line that goes under you know, syntax issues and stuff like that.
So when it highlights them, what has done is it's taken the code in
your file and it's handed it off to the parser, and the parser parses
it and then hands back, hey, this is valid, this isn't valid.
And apparently the Prison parser does that a lot better, and so it's
a lot cleaner as far as picking up issues within your Ruby code and getting
that back to you in a timely and accurate manner, and so that's that's
way awesome. It does a whole bunch of other things as well, but
yeah, I'm really really excited about that. Another one is I talked to
Sam Williams about the Async library and fiber schedulers and the Falcon web server,
and so a lot of that speaks to specifically the performance of Ruby and the
concurrency models that Ruby's able to execute. And it makes things a whole lot
faster without having to like optimize every little tiny piece of the programming language,
because it allows you to do multiple things at the same time on a machine
in a more efficient way. And so anyway, our ability to be able
to run things in parallel and to do better work in Ruby and get things
done more quickly is enhanced by those kinds of advantages and things upcoming. And
then also talk to Jeremy Evans about some of the stuff that he's been doing
with the Ruby programming language, and specifically he talked about how Ruby allocates a
rays and so if there's any kind of list of anything, a lot of
times I guess Ruby will break up the array and store it across the heap
instead of storing it in one continuous part of the heap, and it might
allocate things moreultiple times and things like that. He explains it much better in
the interviews to go check it out, and so anyway, he breaks down
how he's put that together so that it does fewer allocations and more efficient allocations,
and then when it goes to clean up, then it can do less
work that way, and that also enhances performance because the garbage collector doesn't have
to run as long, and because Ruby is more memory efficient. So anyway,
tons and tons and tons of stuff. Another one that I talked to
Sotro Matsumoto, and he's been working on RBS or Ruby types or types in
the Ruby language, and so we went into all of that and what it
means, and I'm I have to admit I'm not completely sold on types or
type annotations in Ruby. But at the same time, I mean, there
are a lot of people out there doing typescript because it helps eliminate certain classes
of bugs, and so I can understand the attraction if you're consistently running into
those. I still think that in Ruby the most common error is the type
error. This function doesn't exist in nil or this method doesn't exist on nil
and so you look at that and you go, Okay, well, maybe
if we could eliminate a whole bunch of those, we'd have better, more
reliable programs. And maybe, but there are other ways to infer types if
you look at type prof and other things. So but anyway, he dives
into that and he talks about some of those differences between the two philosophies that
I kind of outlined, and why it may or may not make sense under
one circumstance or another, and what's been done there. So if you're interested
in Ruby types, definitely check that off or check that out. I talked
to Stephen Markheim about sequel LIGHTE on rails and sequel LIGHTE and Ruby, which
isn't directly the programming language, but again, you know, it comes back
to these options that we have on how and where we run Ruby, and
so that's all very very exciting. And then you know, another engine that's
out there is Dragon Ruby and I talked about it in the platforms discussion that
I had a few days ago, but it's also a Ruby engine that runs
on the mobile and does its thing there. And so that and Ruby WASM
and the opportunities that come out of that are just anyway, very very exciting
stuff. So if you want to dive into some of the performance stuff,
or if you want to dive into some of the language feature stuff that it's
coming out, they definitely check those out. Again. Those are the talks
by Utah Zito for Ruby, WAM for Samuel Williams with a Sink and Falcon,
Jeremy Evans where he talked about the allocation stuff and gems and sequel and
Rode and all that good stuff, and then Soto Matsumoto talking about RBS and
typing. So anyway, today's talks are going to be Alex Rudahl talking about
the open aigm and stuff like that that he's doing, Jeremy Evans, like
I said, wrote a sequel and performance, Sotoro Matsumoto is today he's talking
about RBS and the typing system, Andy Mala talking about Glimmer and Glimmer UI
which incidentally is also running Ruby on the desktop, and Jason Sweat from Code
with Jason and since they Ruby. So if you're into all that, check
it out. If you want the talks from from the last few days,
you can get them by signing up for Ruby bits, rails, clips or
a combo of both, and yeah, looking forward to meeting up with you
all as time goes on and keep an eye out for things. I'm also
going to really briefly tease that I am working with Alex Alex Rudall to put
together and open Ai five Day Ruby Challenge, and so if you want to
check that out, go to five day Ruby dot com and we will have
that all available so that you can sign up for the challenge. And then
if you're looking to get into some of that AI or ali AI tooling from
open ai, will definitely do that. I'm also talking to a few other
people about other options either within the AI space or with building SaaS, so
we'll do other challenges going forward. But that's what I got for today,
So until next time, Max out