Project

General

Profile

Actions

Bug #21838

closed

Rails seeing degradation (20% slowdown) related to Revision 079ef92b "Implement global allocatable slots and empty pages" (from Sep 5 2024)

Bug #21838: Rails seeing degradation (20% slowdown) related to Revision 079ef92b "Implement global allocatable slots and empty pages" (from Sep 5 2024)

Added by bluz71 (Dennis B) 6 days ago. Updated 4 days ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.4.0dev (2024-09-09T14:15:21Z v3_4_0_preview2~545 079ef92b5e)
[ruby-core:124552]

Description

Hello,

I noticed a performance degradation with Ruby 3.4 when seeding my Rails application, which does image derivation via the Shrine Gem and libvips image library.

I skipped Ruby 3.4 hoping that 4.0 would magically solve my performance issue. Alas not.

My degradation when doing rails db:reset (aka database seeding) was about 20% as compared with Ruby 3.3.

The last couple of days I looked at this issue more closely and with the help of git bisect I believe this commit: https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/079ef92b5e59b616d670efe81a33e500f2bf6451 is the cause of my regression. That commit implements global allocatable slots and empty pages.

The revision before is fast when seeding my Rails application.
This revision however slows down my Rails seeding by about 20%, from 30 seconds to 40 seconds consistently.

I created a minimal Rails application as the reproducible test case: https://github.com/bluz71/rails_app_ruby_slowdown

Steps to reproduce:

  1. git clone https://github.com/bluz71/rails_app_ruby_slowdown
  2. cd rails_app_ruby_slowdown
  3. bundle config set force_ruby_platform true
  4. bundle install
  5. bundle exec rails db:create
  6. RUBY_YJIT_ENABLE=0 time bundle exec rails db:reset

Note, libvips needs to be installed at the system level, for example sudo apt install libvips, libvips is the image processing library used by Shrine which in turn is used in this Rails application when seeding.

Use Ruby 3.3 and 3.4 to compare, or use Revision de7ac11a (https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/de7ac11a09249defd93d1ee34c817fa9d31e7936) and Revision 079ef92b (https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/079ef92b5e59b616d670efe81a33e500f2bf6451) to compare.

I hope this is reproducible, if so, I also hope this performance loss can be minimised in future.

Best regards.

Actions

Also available in: PDF Atom