Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change prepend MemoWise to extend MemoWise #253

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Or install it yourself as:

## Usage

When you `prepend MemoWise` within a class or module, `MemoWise` exposes three
When you `extend MemoWise` within a class or module, `MemoWise` exposes three
methods:

- [`memo_wise`](https://rubydoc.info/github/panorama-ed/memo_wise/MemoWise#memo_wise-class_method)
Expand All @@ -51,7 +51,7 @@ methods:

```ruby
class Example
prepend MemoWise
extend MemoWise

def slow_value(x)
sleep x
Expand Down Expand Up @@ -87,7 +87,7 @@ The same three methods are exposed for class methods as well:

```ruby
class Example
prepend MemoWise
extend MemoWise

def self.class_slow_value(x)
sleep x
Expand Down Expand Up @@ -117,7 +117,7 @@ Benchmarks are run in GitHub Actions, and the tables below are updated with ever

Results using Ruby 3.1.0:

|Method arguments|`Dry::Core` (0.7.1)|`Memery` (1.4.0)|
|Method arguments|`Dry::Core`\* (0.7.1)|`Memery` (1.4.0)|
|--|--|--|
|`()` (none)|1.09x|11.80x|
|`(a)`|1.64x|9.74x|
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmarks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def benchmark_name
# been `require`d.
BENCHMARK_GEMS = [
BenchmarkGem.new(MemoWise_GitHubMain, "prepend #{GITHUB_MAIN}", :memo_wise),
BenchmarkGem.new(MemoWise, "prepend MemoWise", :memo_wise),
BenchmarkGem.new(MemoWise, "extend MemoWise", :memo_wise),
(BenchmarkGem.new(DDMemoize, "DDMemoize.activate(self)", :memoize) if defined?(DDMemoize)),
(BenchmarkGem.new(Dry::Core, "include Dry::Core::Memoizable", :memoize) if defined?(Dry::Core)),
(BenchmarkGem.new(Memery, "include Memery", :memoize) if defined?(Memery)),
Expand Down
Loading