Skip to content
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 for Ruby 3.3 #336

Open
bananastalktome opened this issue Aug 7, 2024 · 2 comments
Open

Support for Ruby 3.3 #336

bananastalktome opened this issue Aug 7, 2024 · 2 comments

Comments

@bananastalktome
Copy link

bananastalktome commented Aug 7, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave "+1" or "me too" comments. They generate extra noise for issue followers and do not help prioritize the request.

Tell us about your request
Since Ruby 3.3 has been out for some time now (3.3.0 released 2023-12-25, current release as of this issue creation is 3.3.4 released 2024-07-09), it would be nice to have Ruby 3.3 support on the Beanstalk platform.

Is this request specific to an Elastic Beanstalk platform?
Ruby

Attachments
https://www.ruby-lang.org/en/news/2023/12/25/ruby-3-3-0-released/
https://www.ruby-lang.org/en/news/2024/07/09/ruby-3-3-4-released/
amazonlinux/amazon-linux-2023#776

@sriram2520
Copy link

Is there any expected release date on this? Thanks in advance

@Souravgoswami
Copy link

Souravgoswami commented Sep 29, 2024

It's a shame that Ruby 3.3 still isn't supported as it's been over 9 months since its first release, and Ruby 3.4 is almost here!

In the past, AWS Elastic Beanstalk provided Ruby 2.7 was compiled with aggressive optimizations at the O3 level (using -march=native -mtune=native). However, Ruby 3.2 is now compiled with the following flags on Amazon Linux 2023 on Elastic Beanstalk t3.small instance:

$ ruby -e "puts RbConfig::CONFIG['CFLAGS']"
-O2 -ftree-vectorize -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC

But the system supports more advanced binaries, as shown below:

$ curl http://169.254.169.254/latest/meta-data/instance-type ; echo
t3.small

$ /lib64/ld-linux-x86-64.so.2 --help | awk 'BEGIN {IGNORECASE=1} /glibc-hwcaps/ {flag=1; next} /Legacy HWCAP/ {flag=0} flag && /x86-64-v[0-9]/'
  x86-64-v4 (supported, searched)
  x86-64-v3 (supported, searched)
  x86-64-v2 (supported, searched)

We're clearly not taking full advantage of the available hardware.

An optimized version of Ruby compiled for native targets would be great.

Q. Does it really matter?
A. Definitely.

Here's a comparison:

Natively Compiled Ruby with O3:

$ ruby -e 'puts "Ruby: #{RUBY_VERSION}; CFLAGS: #{RbConfig::CONFIG[%(CFLAGS)]}"'
Ruby: 3.2.5; CFLAGS: -O3 -march=native -mtune=native -fno-plt -fPIC

$ bin/optcarrot --benchmark examples/lawn_mower.zip 
fps: 52.51
checksum: 52989

$ bin/optcarrot --benchmark examples/lawn_mower.zip 
fps: 53.25
checksum: 52989

System Ruby (generic target as provided by Archlinux):

$ ruby -e 'puts "Ruby: #{RUBY_VERSION}; CFLAGS: #{RbConfig::CONFIG[%(CFLAGS)]}"'
Ruby: 3.2.5; CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/ruby/src=/usr/src/debug/ruby -flto=auto -fPIC

$ bin/optcarrot --benchmark examples/lawn_mower.zip 
fps: 45.24
checksum: 52989

$ bin/optcarrot --benchmark examples/lawn_mower.zip 
fps: 45.37
checksum: 52989

A ~20% performance boost for free is sweet, isn't it?

Even though O3 can occasionally cause issues, I've personally never encountered any. Regardless, using native optimizations at O2 would still provide a significant benefit over generic ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: We're Working On It
Development

No branches or pull requests

4 participants