From d0f4515e9454fdd81aa97b4e0120aa36fa4b0c5a Mon Sep 17 00:00:00 2001
From: Jacob Evelyn <jevelyn@panoramaed.com>
Date: Wed, 20 Mar 2024 09:52:32 -0400
Subject: [PATCH] Try yjit benchmarks

---
 .github/workflows/main.yml | 36 ++++++++++++++++++------------------
 .ruby-version              |  2 +-
 README.md                  |  6 +++---
 lib/memo_wise.rb           | 10 +++++-----
 4 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 6c13c04..dbaab02 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -14,7 +14,7 @@ jobs:
       matrix:
         # Due to https://github.com/actions/runner/issues/849, we have to use
         # quotes for '3.0' -- without quotes, CI sees '3' and runs the latest.
-        ruby: [2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, jruby, truffleruby-head]
+        ruby: [2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3, jruby, truffleruby-head]
     runs-on: ubuntu-latest
     steps:
     - uses: actions/checkout@v4
@@ -24,7 +24,7 @@ jobs:
     - name: Set bundler environment variables
       run: |
         echo "BUNDLE_WITH=checks:docs" >> $GITHUB_ENV
-      if: matrix.ruby == 3.2
+      if: matrix.ruby == 3.3
 
     # Use 'bundler-cache: true' instead of actions/cache as advised:
     #   * https://github.com/actions/cache/blob/main/examples.md#ruby---bundler
@@ -33,25 +33,25 @@ jobs:
         ruby-version: ${{ matrix.ruby }}
         bundler-cache: true
 
-    - run: bundle exec rspec
+    # - run: bundle exec rspec
 
-    - uses: codecov/codecov-action@v3
-      with:
-        files: ./coverage/coverage.xml
-        fail_ci_if_error: true # optional (default = false)
-        verbose: true # optional (default = false)
-      if: matrix.ruby == 3.2
+    # - uses: codecov/codecov-action@v3
+    #   with:
+    #     files: ./coverage/coverage.xml
+    #     fail_ci_if_error: true # optional (default = false)
+    #     verbose: true # optional (default = false)
+    #   if: matrix.ruby == 3.3
 
-    - run: bundle exec rubocop
-      if: matrix.ruby == 3.2
+    # - run: bundle exec rubocop
+    #   if: matrix.ruby == 3.3
 
-    - run: |
-        bundle exec yard doctest
-        bundle exec dokaz
-      if: matrix.ruby == 3.2
+    # - run: |
+    #     bundle exec yard doctest
+    #     bundle exec dokaz
+    #   if: matrix.ruby == 3.3
 
-    - name: Run benchmarks on Ruby 2.7 or 3.2
+    - name: Run benchmarks on Ruby 2.7 or 3.3
       run: |
         BUNDLE_GEMFILE=benchmarks/Gemfile bundle install --jobs 4 --retry 3
-        BUNDLE_GEMFILE=benchmarks/Gemfile bundle exec ruby benchmarks/benchmarks.rb
-      if: matrix.ruby == '2.7' || matrix.ruby == '3.2'
+        RUBY_YJIT_ENABLE=1 BUNDLE_GEMFILE=benchmarks/Gemfile bundle exec ruby benchmarks/benchmarks.rb
+      if: matrix.ruby == '2.7' || matrix.ruby == '3.3'
diff --git a/.ruby-version b/.ruby-version
index be94e6f..15a2799 100644
--- a/.ruby-version
+++ b/.ruby-version
@@ -1 +1 @@
-3.2.2
+3.3.0
diff --git a/README.md b/README.md
index ccbabd3..44cd834 100644
--- a/README.md
+++ b/README.md
@@ -114,11 +114,11 @@ For more usage details, see our detailed [documentation](#documentation).
 
 Benchmarks are run in GitHub Actions, and the tables below are updated with every code change. **Values >1.00x represent how much _slower_ each gem’s memoized value retrieval is than the latest commit of `MemoWise`**, according to [`benchmark-ips`](https://github.com/evanphx/benchmark-ips) (2.11.0).
 
-Results using Ruby 3.2.2:
+Results using Ruby 3.3.0 (parentheses using `--yjit`):
 
 |Method arguments|`Dry::Core`\* (1.0.1)|`Memery` (1.5.0)|
 |--|--|--|
-|`()` (none)|0.60x|3.58x|
+|`()` (none)|0.60x (0.40x)|3.58x|
 |`(a)`|1.37x|7.41x|
 |`(a, b)`|1.20x|6.43x|
 |`(a:)`|1.47x|13.60x|
@@ -180,7 +180,7 @@ versions:
 
 We maintain API documentation using [YARD](https://yardoc.org/), which is
 published automatically at
-[RubyDoc.info](https://rubydoc.info/gems/memo_wise). 
+[RubyDoc.info](https://rubydoc.info/gems/memo_wise).
 
 To generate documentation locally or run documentation tests,
 first install the `docs` dependencies (e.g. `yard`) as follows:
diff --git a/lib/memo_wise.rb b/lib/memo_wise.rb
index dace3d6..b5f3850 100644
--- a/lib/memo_wise.rb
+++ b/lib/memo_wise.rb
@@ -31,12 +31,12 @@ module MemoWise
   # [calling the original](https://medium.com/@jeremy_96642/ruby-method-auditing-using-module-prepend-4f4e69aacd95)
   # constructor.
   #
-  # - **Q:** Why is [Module#prepend](https://ruby-doc.org/3.2.2/Module.html#method-i-prepend)
+  # - **Q:** Why is [Module#prepend](https://ruby-doc.org/3.3.0/Module.html#method-i-prepend)
   #          important here
   #          ([more info](https://medium.com/@leo_hetsch/ruby-modules-include-vs-prepend-vs-extend-f09837a5b073))?
   # - **A:** To set up *mutable state* inside the instance, even if the original
   #          constructor will then call
-  #          [Object#freeze](https://ruby-doc.org/3.2.2/Object.html#method-i-freeze).
+  #          [Object#freeze](https://ruby-doc.org/3.3.0/Object.html#method-i-freeze).
   #
   # This approach supports memoization on frozen (immutable) objects -- for
   # example, classes created by the
@@ -101,7 +101,7 @@ def inherited(subclass)
   # @param target [Class]
   #   The `Class` into to prepend the MemoWise methods e.g. `memo_wise`
   #
-  # @see https://ruby-doc.org/3.2.2/Module.html#method-i-prepend
+  # @see https://ruby-doc.org/3.3.0/Module.html#method-i-prepend
   #
   # @example
   #   class Example
@@ -116,7 +116,7 @@ class << target
       #
       # This is necessary in addition to the `#initialize` method definition
       # above because
-      # [`Class#allocate`](https://ruby-doc.org/3.2.2/Class.html#method-i-allocate)
+      # [`Class#allocate`](https://ruby-doc.org/3.3.0/Class.html#method-i-allocate)
       # bypasses `#initialize`, and when it's used (e.g.,
       # [in ActiveRecord](https://github.com/rails/rails/blob/a395c3a6af1e079740e7a28994d77c8baadd2a9d/activerecord/lib/active_record/persistence.rb#L411))
       # we still need to be able to access MemoWise's instance variable. Despite
@@ -268,7 +268,7 @@ def #{method_name}(#{MemoWise::InternalAPI.args_str(method)})
         )
       end
 
-      # Override [Module#instance_method](https://ruby-doc.org/3.2.2/Module.html#method-i-instance_method)
+      # Override [Module#instance_method](https://ruby-doc.org/3.3.0/Module.html#method-i-instance_method)
       # to proxy the original `UnboundMethod#parameters` results. We want the
       # parameters to reflect the original method in order to support callers
       # who want to use Ruby reflection to process the method parameters,