Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fastruby/fast-ruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: fastruby/fast-ruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: array-subset-check-benchmark
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 2 files changed
  • 2 contributors

Commits on Jun 28, 2026

  1. Add array subset-check benchmark across Ruby 3.3, 3.4, 4.0

    Revisits the comparison from the closed #125 (gabteles), fixing the
    reversed Set#subset? arguments so every approach returns the same
    result (guarded by an equivalence check), and benchmarks across modern
    Ruby versions.
    
    Findings:
    - (a1 - a2).empty? is the consistent winner for true-subset inputs.
    - a1.all? { include? } only wins when a1 is NOT a subset (short-circuits)
      and is O(n*m) on large true subsets.
    - Set#subset? (incl. to_set) went from ~6.8x slower on 3.3/3.4 to ~1.7x
      slower on 4.0, where Set got much faster.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    etagwerker and claude committed Jun 28, 2026
    Configuration menu
    Copy the full SHA
    12a1227 View commit details
    Browse the repository at this point in the history
Loading