Ruby 2.4.0 Released
ruby-lang.org
ruby-lang.org
Even if you compared to Python 3, the improvement is still rather small.
I know there is always the argument about the lack of resources, and Rust is being backed by Mozilla while Go is being backed by Google. But what about Python?
Exactly how much money is Mozilla spending on Rust, paying how many developers full time? Apple JS Core team is incredibly small, but they manage a B3 JIT compiler with 2 people.
How much money is needed? Matz and Tenderlove both mention they need more resources. Surely we can fund rise? With lots of successful companies using Ruby on Rails. Basecamp, Twitter, Groupon, Github, Gitlab etc. Or Ruby communities lack the compiler / JIT expert, can we hired some?
I am not trying to downplay the Ruby improvement. But I think Ruby needs more contributors. Moving to GitHub to get a higher exposure has been banned due to GitHub not being an opensoure product. But they also dislike hosting on Gitlab for some strange reason.
I kinda feel like the reason for that is more due to the fact that if python users want change in their language, they really need to either construct their own pre-parser and deal with a lot of potential issues, or post a change, hope it becomes a PEP, and hope it gets accepted. There is very little ways other than that
In ruby, you are enabled to fix so much more of the language to your own liking, so there is much less of a need for the main language to change.
I'm not saying that ruby isn't underfunded, just that it doesn't need to grow as fast as python does
very true. lots of metaprogramming facilities in Ruby that just don't exist in Python. To further underscore your point, take a look at how much of Rails code is devoted to making Ruby more usable/consistent and has a only tangential relationship to web development.
https://www.ruby-lang.org/en/community/ruby-core/ suggests that the main repo is a self-hosted SVN
Check the NEWS[0] file for a bunch more.
And Ruby 2.4 is about 10% faster than 2.3.3 according to some non-micro benchmarks[1].
Re funding: AFAIU the problem for Ruby seems to be the paucity of long term sponsorship deals, rather than one-off funding. Python has a bunch of those[2].
The lack of an important "ruby foundation" might be an issue there.
[0] https://github.com/ruby/ruby/blob/v2_4_0/NEWS
[1] https://gettalong.org/blog/2016/ruby24-performance-looking-g...
It is not about optimal performance. Ruby, or specifically MRI here, is anywhere between 20-100x slower. And there are other dynamic languages that is much faster then Ruby. If Ruby is only 2-10x slower no one would complain. But right now it is so far off the chart that is why you see a shrinking usage of Ruby.
So when the plan will be realized, it would be these 2-10x slower than others.
The article clear states that, as well as numerous other sources Ruby 3x3 means Ruby 3.0 will be 3 times faster. The problem is it will be 3 times faster then 2.0, and we already have 30-40% speedup from 2.0. So for Ruby 3.0 is likely only 2.2x faster then Ruby 2.4.
2.2x, in the grand view of things, is still very slow.
In python, on the other hand, years later it's still a shit show. The community still hasn't embraced one or the other. Some people still refuse to upgrade to 3.x. Everything is splintered. It's especially hurtful to newcomers.
I dont mean to be rude but Ruby communities, and within the Core team lacks expertise in Compiler / JIT programming.
* Hash improvements via better locality for modern CPUs
* #max and #min without temporary array
* Speed up instance variable accessMy experience has taught me that not having type annotations in a source code makes it very hard to understand and maintain that source in the long run.
They rarely see much use, though, because most of us quickly experience that the type annotations that seem essential when we work on statically typed languages quickly become less essential once you adopt a more idiomatic Ruby style.
E.g. if you want to output something as text, rather than dictate what should be passed in, call #to_s on it (and optionally handle the failure if it doesn't implement #to_s, if it is reasonable to continue).
Once you adopt the attitude of asking for what you actualy need rather than demanding the client pass in what you think should be passed in, type annotations start feeling like a clamp around your foot rather than a necessity in most cases, and most of the remaining assistance they could provide tends to fall away with test cases you would require in either case.
I used to be a static typing zealot, and I still want things to be "as static as possible", but I've come to accept that most of the time the burdens it adds are not worth the benefits.
I'm sure we can do better, and there are certainly cases where optional static type annotation could be helpful, but at this point I'm not giving up the expressiveness dynamc typing gives me - a static system would need to be practically "invisible" for me to find it acceptable.
I won't deny there are some clever things one can do to improve code with sophisticated typing. However, the typical usage is to alleviate the mistakes of bad names and poor design. When I find type errors at runtime, I look for a way to refactor that avoids confusion without needing to add type checking. I don't always succeed, but when I do the code is more elegant.
https://redmine.ruby-lang.org/issues/6037
You can (must) be pragmatic, of course; and assume that all will go well. But under the hood, it means a great many objects get pointlessly allocated and reallocated - or not, sometimes, with hard to find bugs occurring when a gem author overoptimizes their code to avoid making a few object copies, and ends up mutating your object's properties without you realizing it.
Things have improved since, with e.g. strings being frozen by default if you want them to be since a few versions ago. Even in this changelog, there's a least one point related to memory allocation that touches the performance consequences of needlessly allocating new objects.
Back then, I found Obj-C (and Swift, maybe?) more conforting in this respect, with most things being immutable unless you explicitly requested the mutable version. And I liked ARC a lot. (I haven't programmed much in recent years, so can't say what I'd use today if I were neck deep into code. Probably Swift.)
Another issue was that Ruby was then attracting a lot of end-users that had no formal software engineering skills. Which is fine for day to day tasks; not so much when they start distributing libraries. (Always vet your gems' authors and source code.)
I still love Ruby, mind you. It's beautifully expressive and it's still my preferred language for non-trivial "glue" tasks.
It was very good at the time. Not so much today. We've learned a lot in language design and Ruby feels very antiquated (mostly because it's dynamically typed).
My favorite statically typed languages are Haskell, Rust and C# but I prefer Ruby over them whenever possible.
So far, Kotlin has hit that sweet spot for me.
Working with Tensorflow, python is unfortunately the only realistic option. I'm getting the hang of it, but I'd still love to use ruby for it – it's all just data wrangling, it doesn't even need to be fast, and ruby code is just beautiful (to my eyes, I know it's a matter of opinion).
I've also only recently discovered the beauty that is rake. Especially for data pipelines it's a fantastic tool. Hit a bug? No need to rerun everything – it'll pick up at the exact step that failed. One of ten data files changed? It knows exactly what needs to be redone. Etc.
https://medium.com/@Arafat./introducing-tensorflow-ruby-api-...
require 'pry'
module Kernel
def debug; binding.pry; end
end
x = "hi"
debugOr do you recommend this monkeypatch in practice?
irb(main):008:0> x = "1"
=> "1"
irb(main):009:0> debug
[1] pry(main)> x
NameError: undefined local variable or method `x' for main:Object
from (pry):1:in `debug'
If you really want to do this, you can use binding_of_caller[1] to create binding object (`Kernel.binding`) up in the call stack: require 'binding_of_caller'
require 'pry'
module Kernel
def debug
binding.of_caller(1).pry
end
end
Then: irb(main):008:0> x = "1"
=> "1"
irb(main):009:0> debug
[1] pry(main)> x
=> "1"
[1]: https://github.com/banister/binding_of_callerYou'd think Ruby would be swimming in easy-to-use widget libraries. But it still isn't. Shoes fits most of my needs, though I'm still working on my workflows and tooling. It's annoying that I can't just write to the console or drop in a pry session, but I'm slowly figuring it out.
I've looked at Shoes multiple times for various projects and it always looks terrific, until I remember that installing it involves downloading a 64-bit binary from a website. I've bitten the bullet before and done it, but it's an (ugly) step backwards compared to `gem` and the Qt/Gtk+ bindings that can be installed via `gem`.
The downside is you end up accumulating dead values.
It seems they just made it harder to write interfaces that take advantage of machine precision integers. They didn't remove either arbitrary precision integers or machine precision integers, they just made them harder to distinguish. Why is this an improvement?
There isn't (at least I've never seen it) any reason to distinguish between the two, Fixnum wasn't the proper tool to do machine-precision integer operations either (31 bit).
[1]: https://www.ruby-lang.org/en/news/2013/12/21/ruby-version-po...