From acffd63f8f12f6783152187bd1bba9a6d9f64eeb Mon Sep 17 00:00:00 2001 From: Randy Stauner Date: Thu, 29 Jun 2023 16:27:22 -0700 Subject: [PATCH] Consider truffleruby as supported for yaml/json compile cache Tests pass with 21 less skips. This improves the speed of `Faker::Config.locale` on truffleruby by over 50%. This moves truffleruby from "minimal" to the full suite in CI. --- .github/workflows/ci.yaml | 4 ++-- CHANGELOG.md | 2 ++ ext/bootsnap/extconf.rb | 2 +- lib/bootsnap/compile_cache.rb | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9a4cd59..f36744e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -43,7 +43,7 @@ jobs: fail-fast: false matrix: os: [ubuntu] - ruby: ['2.6', '2.7', '3.0', '3.1', '3.2', 'ruby-head', 'debug'] + ruby: ['2.6', '2.7', '3.0', '3.1', '3.2', 'ruby-head', 'debug', 'truffleruby'] runs-on: ${{ matrix.os }}-latest steps: - uses: actions/checkout@v2 @@ -75,7 +75,7 @@ jobs: fail-fast: false matrix: os: [ubuntu] - ruby: ['jruby', 'truffleruby'] + ruby: ['jruby'] runs-on: ${{ matrix.os }}-latest steps: - uses: actions/checkout@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index dc0891d..543db62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased +* Support YAML and JSON CompileCache on TruffleRuby. + # 1.16.0 * Use `RbConfig::CONFIG["rubylibdir"]` instead of `RbConfig::CONFIG["libdir"]` to check for stdlib files. See #431. diff --git a/ext/bootsnap/extconf.rb b/ext/bootsnap/extconf.rb index f4fe45c..d6d48c0 100644 --- a/ext/bootsnap/extconf.rb +++ b/ext/bootsnap/extconf.rb @@ -2,7 +2,7 @@ require("mkmf") -if RUBY_ENGINE == "ruby" +if %w[ruby truffleruby].include?(RUBY_ENGINE) $CFLAGS << " -O3 " $CFLAGS << " -std=c99" diff --git a/lib/bootsnap/compile_cache.rb b/lib/bootsnap/compile_cache.rb index c73cb55..ee2f47e 100644 --- a/lib/bootsnap/compile_cache.rb +++ b/lib/bootsnap/compile_cache.rb @@ -54,7 +54,7 @@ def self.permission_error(path) def self.supported? # only enable on 'ruby' (MRI), POSIX (darwin, linux, *bsd), Windows (RubyInstaller2) and >= 2.3.0 - RUBY_ENGINE == "ruby" && RUBY_PLATFORM.match?(/darwin|linux|bsd|mswin|mingw|cygwin/) + %w[ruby truffleruby].include?(RUBY_ENGINE) && RUBY_PLATFORM.match?(/darwin|linux|bsd|mswin|mingw|cygwin/) end end end