Skip to content

Commit

Permalink
🎨 Address code review feedback from @JacobEvelyn
Browse files Browse the repository at this point in the history
  • Loading branch information
pboling committed Sep 18, 2024
1 parent 11cbd2a commit b488bf9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 33 deletions.
26 changes: 13 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,39 @@ _No breaking changes!_
**Project enhancements:**

- Updated official test coverage to support Ruby 3.3 [[#335](https://github.com/panorama-ed/memo_wise/pull/335)]
- Added `alt_memery` and `memoist3` to benchmarks [#339](https://github.com/panorama-ed/memo_wise/pull/339)
- Updated benchmark results in `README.md` to Ruby 3.3.5
- Added `alt_memery` and `memoist3` to benchmarks [[#339](https://github.com/panorama-ed/memo_wise/pull/339)]
- Updated benchmark results in `README.md` to Ruby 3.3.5 [[#339](https://github.com/panorama-ed/memo_wise/pull/339)]

## [v1.9.0](https://github.com/panorama-ed/memo_wise/compare/v1.8.0...v1.9.0)

**Gem enhancements:**

- Fixed a bug that overwrote existing self.extended method definitions. [[#324]](https://github.com/panorama-ed/memo_wise/pull/314)
- Fixed a bug that overwrote existing self.inherited method definitions. [[#325]](https://github.com/panorama-ed/memo_wise/pull/315)
- Fixed a bug that overwrote existing self.extended method definitions. [[#324](https://github.com/panorama-ed/memo_wise/pull/314)]
- Fixed a bug that overwrote existing self.inherited method definitions. [[#325](https://github.com/panorama-ed/memo_wise/pull/315)]

_Breaking changes:_
- Removed Ruby 2.4 (EOL) support to allow upgrading rexml dependency version from a version that includes a [CVE](https://www.ruby-lang.org/en/news/2024/05/16/dos-rexml-cve-2024-35176/) [[#336]](https://github.com/panorama-ed/memo_wise/pull/336)
- Removed Ruby 2.4 (EOL) support to allow upgrading rexml dependency version from a version that includes a [CVE](https://www.ruby-lang.org/en/news/2024/05/16/dos-rexml-cve-2024-35176/) [[#336](https://github.com/panorama-ed/memo_wise/pull/336)]

**Project enhancements:**

- Fixed `bundle exec yard server --reload` and related documentation [[#333]](https://github.com/panorama-ed/memo_wise/pull/333)
- Fixed Codecov rate limiting errors affecting pull requests by upgrading `codecov/codecov-action` and using a Codecov token [[#317]](https://github.com/panorama-ed/memo_wise/pull/317)
- Fixed `bundle exec yard server --reload` and related documentation [[#333](https://github.com/panorama-ed/memo_wise/pull/333)]
- Fixed Codecov rate limiting errors affecting pull requests by upgrading `codecov/codecov-action` and using a Codecov token [[#317](https://github.com/panorama-ed/memo_wise/pull/317)]

## [v1.8.0](https://github.com/panorama-ed/memo_wise/compare/v1.7.0...v1.8.0) - 2023-10-25

**Gem enhancements:**

- In Ruby3.2+, for singleton classes, use `#attached_object` instead of `ObjectSpace` [[#318]](https://github.com/panorama-ed/memo_wise/pull/318)
- In Ruby3.2+, for singleton classes, use `#attached_object` instead of `ObjectSpace` [[#318](https://github.com/panorama-ed/memo_wise/pull/318)]

_No breaking changes!_

**Project enhancements:**

- Switched RuboCop configuration from `panolint` to `panolint-ruby` [[#312]](https://github.com/panorama-ed/memo_wise/pull/312)
- Updated benchmark results in `README.md` to Ruby 3.2.2 and 2.7.8 [[#313]](https://github.com/panorama-ed/memo_wise/pull/297)
- Updated `Dry::Core` gem version to 1.0.0 in benchmarks [[#297]](https://github.com/panorama-ed/memo_wise/pull/297)
- Updated `Memery` gem version to 1.5.0 in benchmarks [[#313]](https://github.com/panorama-ed/memo_wise/pull/313)
- Updated `Memoized` gem version to 1.1.1 in benchmarks [[#288]](https://github.com/panorama-ed/memo_wise/pull/288)
- Switched RuboCop configuration from `panolint` to `panolint-ruby` [[#312](https://github.com/panorama-ed/memo_wise/pull/312)]
- Updated benchmark results in `README.md` to Ruby 3.2.2 and 2.7.8 [[#313](https://github.com/panorama-ed/memo_wise/pull/297)]
- Updated `Dry::Core` gem version to 1.0.0 in benchmarks [[#297](https://github.com/panorama-ed/memo_wise/pull/297)]
- Updated `Memery` gem version to 1.5.0 in benchmarks [[#313](https://github.com/panorama-ed/memo_wise/pull/313)]
- Updated `Memoized` gem version to 1.1.1 in benchmarks [[#288](https://github.com/panorama-ed/memo_wise/pull/288)]
- Reorganized `CHANGELOG.md` for improved clarity and completeness [[#282](https://github.com/panorama-ed/memo_wise/pull/282)]

## [v1.7.0](https://github.com/panorama-ed/memo_wise/compare/v1.6.0...v1.7.0) - 2022-04-04
Expand Down
3 changes: 1 addition & 2 deletions benchmarks/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby ">= 2.7.7"

gem "benchmark", "0.3.0"
gem "benchmark-ips", "2.14.0"
gem "gem_bench", "2.0.1"

# NOTE: Regarding `require: false` below
# 1. GitHub version of MemoWise and the local source of MemoWise, share a namespace
# 1. GitHub version of MemoWise and the local source of MemoWise share a namespace
# 2. memery & alt_memery share the namespace Memery
# 3. memoist & memoist3 share the namespace Memoist, and also share a load path for their version.rb files.
# This means we must `require: false` in `benchmarks/Gemfile` all, or all but one, of each of these duplicates,
Expand Down
31 changes: 13 additions & 18 deletions benchmarks/benchmarks.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# frozen_string_literal: true

require "tempfile"
require "benchmark"
require "benchmark/ips"
require "gem_bench/jersey"

# Constants used for temp file paths necessary to separate gem namespaces that would otherwise collide.
GITHUB_MAIN = "MemoWise_GitHubMain"
GITHUB_MAIN_BENCHMARK_NAME = "memo_wise-git-main"
GITHUB_MAIN_BENCHMARK_NAME = "memo_wise-github-main"
LOCAL_BENCHMARK_NAME = "memo_wise-local"

# 1. GitHub version of MemoWise and the local source of MemoWise, share a namespace
# 1. GitHub version of MemoWise and the local source of MemoWise share a namespace
# 2. memery & alt_memery share the namespace Memery
# 3. memoist & memoist3 share the namespace Memoist, and also share a load path for their version.rb files.
# This means we must `require: false` in `benchmarks/Gemfile` all, or all but one, of each of these duplicates,
Expand Down Expand Up @@ -59,9 +58,10 @@
),
].each(&:doff_and_don) # Copies, re-namespaces, and requires each gem.

# Here we require memo_wise gem from the `pwd` source.
# Separately, in the Gemfile, we download the main branch of MemoWise from GitHub.
# We've already moved it into a tmp directory and re-namespaced it to allow benchmark comparison with local source.
# We've already installed the `memo_wise` version on the `main` branch from GitHub in the
# Gemfile, and moved it into a tmp directory and re-namespaced it so it doesn't collide with
# the `MemoWise` constant. Now we require the local version of `memo_wise` to compare
# this branch against it.
require_relative "../lib/memo_wise"

# Some gems do not yet work in Ruby 3 so we only require them if they're loaded
Expand All @@ -70,12 +70,7 @@
each { |gem| require gem if Gem.loaded_specs.key?(gem) }

# Some Gems Have Modules Which Need To Be Required Manually:
# 1. `dry-core` => Memoizable
{
# file_path => gem_name
"dry/core/memoizable" => "dry-core",
}.
each { |file_path, gem_name| require file_path if Gem.loaded_specs.key?(gem_name) }
require "dry/core/memoizable" if Gem.loaded_specs.key?("dry-core")

# The VERSION constant does not get loaded above for these gems.
%w[memoized memoizer].
Expand Down Expand Up @@ -123,12 +118,12 @@ def benchmark_name
)
end
benchmarked_gems.push(
BenchmarkGem.new(MemoWise, "prepend MemoWise", :memo_wise, LOCAL_BENCHMARK_NAME),
(BenchmarkGem.new(DDMemoize, "DDMemoize.activate(self)", :memoize, "ddmemoize") if defined?(DDMemoize)),
(BenchmarkGem.new(Dry::Core, "include Dry::Core::Memoizable", :memoize, "dry-core") if defined?(Dry::Core)),
(BenchmarkGem.new(Memery, "include Memery", :memoize, "memery") if defined?(Memery)),
(BenchmarkGem.new(Memoized, "include Memoized", :memoize, "memoized") if defined?(Memoized)),
(BenchmarkGem.new(Memoizer, "include Memoizer", :memoize, "memoizer") if defined?(Memoizer))
BenchmarkGem.new(MemoWise, "prepend MemoWise", :memo_wise, LOCAL_BENCHMARK_NAME),
(BenchmarkGem.new(DDMemoize, "DDMemoize.activate(self)", :memoize, "ddmemoize") if defined?(DDMemoize)),
(BenchmarkGem.new(Dry::Core, "include Dry::Core::Memoizable", :memoize, "dry-core") if defined?(Dry::Core)),
(BenchmarkGem.new(Memery, "include Memery", :memoize, "memery") if defined?(Memery)),
(BenchmarkGem.new(Memoized, "include Memoized", :memoize, "memoized") if defined?(Memoized)),
(BenchmarkGem.new(Memoizer, "include Memoizer", :memoize, "memoizer") if defined?(Memoizer))
)
BENCHMARK_GEMS = benchmarked_gems.compact.shuffle

Expand Down

0 comments on commit b488bf9

Please sign in to comment.