-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Ruby 2.6.5 by avoiding pattern matching in call
#13
Comments
@ElMassimo Thanks for your interest. Ruby 2.7+ is a strategic choice, not a technical one. The reason behind it's simple: starting something in 2020, with 3.0 released this year, it makes no sense for me as a maintainer to support old Ruby versions. Given 2.7 supports pattern matching, I wanted to experiment with it, and the result is very satisfying. More on that, we're aiming to target 2.7+ only for the other Hanami 2.x gems. Right now we're still supporting 2.3 for Hanami 1.x. The bump to Hanami 2.x is a good opportunity to get rid of past versions. We don't want to start with Ruby versions that are about to reach EOL soonish. 2.5 EOL is planned for 2021-03-31 Do you know what will happen to TruffleRuby when MRI 3.0 will be released? That is a good question to answer. Not being able to jump from 2.6 to 2.7 compat is worrying for me. I tried your patch with TruffleRuby 20 (
Do you plan to use Hanami::API and TruffleRuby in production? |
Thanks for the reply, it makes complete sense to focus current efforts in the upcoming versions of Ruby 👌 Regarding those failing tests, I forgot to push a keywords-related change. In summary:
Thanks again, and keep up the good work! |
@ElMassimo Thanks for sharing the result graphs, do you still have the CSV files? Would you mind to paste the results here? Thanks in advance. |
Sure thing! Memory
Runtime with Startup
Runtime
|
@ElMassimo Thank you very much. How is it possible that TruffleRuby so slower if compared with MRI? For instance, the differences for the Runtime section are impressive. That was unexpected. EDIT: I asked on Twitter: https://twitter.com/jodosha/status/1265648619534913537?s=20 |
Unexpected, right? I asked in the TruffleRuby project to see if it could be related with the benchmark not running long enough, or one of the Testing slower frameworks like Sinatra or Rails, the tests ran for over 10 minutes, but the difference in behavior was similar. Not sure how much time is needed for it to warm up. |
@ElMassimo From Twitter there is the suggestion to run the benchmark with warmup. r10k has an env var for that: |
warmup iterations will definitely help since this benchmark does n process spawns per benchmark run. Each one of those runs will start out cold again and need to warm up to show eventual performance. |
Thanks for the interesting issue and the performance measurements, we'll look into it in oracle/truffleruby#1939 Regarding pattern matching it would be alright to add to TruffleRuby, as it's compatible with older versions (unlike the keyword arguments changes which are still heavily discussed), as mentioned in oracle/truffleruby#2004 (comment). It's probably quite some work to implement though. Maybe https://github.com/ruby-next/ruby-next can help for pattern matching until it's implemented in the parser & translator. |
Thanks for sharing, very interesting project, funny that the transpiled pattern matching is faster than the implementation in |
FWIW, JRuby will release a new version with 2.6 support, but we will NOT be moving to 2.7 soon because of the breaking changes in keyword arguments. I would strongly recommend supporting 2.6 for at least another year. JRuby will move to 2.7 if the keyword argument situation gets settled, or to 2.8 if that happens. If there's a 3.0 this year (I personally think it would be premature) we'll look at supporting it during 2021. |
It will be a bit better in 3.0 (btw, I used a slightly modified
That's the main reason I started working on Ruby Next—to be able to use modern features w/o sacrificing compatibility with older Rubies (and alternative Rubies, too). @jodosha If you're interested in giving Ruby Next a try, I would be glad to propose a PR. For what I see now, that's gonna be a small addition to the codebase and one more runtime dependency. |
Description 📖
Using pattern matching makes the
call
algorithm very elegant and robust in terms of type checking, but as a result Ruby versions lower than2.7.0
are not supported.In particular, this means that
hanami-api
can't be used with TruffleRuby, which at the moment doesn't have plans to support2.7.0
, as well as other Ruby implementations.Performance and Adoption 🚀
To improve the adoption of
hanami-api
, it might be nice to avoid pattern matching at the moment despite of the uglier implementation, which would allow to use it in non-MRI rubies as well as older Ruby versions.Ran the benchmarks in
r10k
, and there doesn't seem to be a significant difference in performance, which is good (the modified version was slightly faster and used slightly less memory when I tested it).Question ❔
Is the Ruby 2.7.0 choice related to the delegation problem?
The text was updated successfully, but these errors were encountered: