memo_wise 1.9.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcbf16d5dbb7dcebd8181d89b17e550f493afb08e8c3f46c2e56d1c6d224a71d
4
- data.tar.gz: bff1adee597c5a29fea1223604733a23b5b10e800e217d7b7e73d715b0c221cf
3
+ metadata.gz: e8952e8502c321491683a97a919c0602525679ec9a31e8e8df7262e99c3dd7d7
4
+ data.tar.gz: 45f435f7ed3849ff5c5428f9f87889f0ae9174e3d86acf932b1dfad997b96e9f
5
5
  SHA512:
6
- metadata.gz: 477aac5ab8f66cf7287ff976a484d8ba06447587f997e612fccee952d003b688c79d9d934f28d730443d7c23fdeca4d90ec0adb79f6dea9f5bdc11b0b9d3820e
7
- data.tar.gz: 99175b330fd6235bab7967545177298d2ccaa3fbab2c2d860aaa7f686f48e581ec7d5ef2e036a760759e48bec8618b24b1784227e9eb762052dac4649f102813
6
+ metadata.gz: 89e03eef772cbf1ac2ba3e8e465b163a8486fcac2d63dd07c7e840c9455efbef66ae728c05210ca78fabe22ea8b0d397c671ba2aa8e596c5239e8da868535967
7
+ data.tar.gz: 10592d9814aa8085e140e79f90174ef93b627d54330294bc0427f0a6316464d4fa3d01f5a25b84aa59f8e98a7bf9c5511d9d0087f82efd4a3519b0e47637e6ab
data/CHANGELOG.md CHANGED
@@ -5,7 +5,7 @@ follows a format inspired by [Keep a Changelog](https://keepachangelog.com/en/1.
5
5
 
6
6
  This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [Unreleased](https://github.com/panorama-ed/memo_wise/compare/v1.9.0...HEAD)
8
+ ## [Unreleased](https://github.com/panorama-ed/memo_wise/compare/v1.10.0...HEAD)
9
9
 
10
10
  **Gem enhancements:**
11
11
 
@@ -13,6 +13,18 @@ _No breaking changes!_
13
13
 
14
14
  **Project enhancements:**
15
15
 
16
+ ## [v1.10.0](https://github.com/panorama-ed/memo_wise/compare/v1.9.0...v1.10.0)
17
+
18
+ **Gem enhancements:**
19
+
20
+ - Reduced gem size from 173 kB compressed (312 kB unpacked) to 20 kB (68 kB unpacked) [[#345](https://github.com/panorama-ed/memo_wise/pull/345)]
21
+
22
+ _No breaking changes!_
23
+
24
+ **Project enhancements:**
25
+
26
+ - Updated official test coverage to support Ruby 3.3 [[#335](https://github.com/panorama-ed/memo_wise/pull/335)]
27
+
16
28
  ## [v1.9.0](https://github.com/panorama-ed/memo_wise/compare/v1.8.0...v1.9.0)
17
29
 
18
30
  **Gem enhancements:**
@@ -70,7 +82,7 @@ _No breaking changes!_
70
82
 
71
83
  **Project enhancements:**
72
84
 
73
- - Update official test coverage to support Ruby 3.1 [[#263](https://github.com/panorama-ed/memo_wise/pull/263)]
85
+ - Updated official test coverage to support Ruby 3.1 [[#263](https://github.com/panorama-ed/memo_wise/pull/263)]
74
86
 
75
87
  ## [v1.5.0](https://github.com/panorama-ed/memo_wise/compare/v1.4.0...v1.5.0) - 2021-12-17
76
88
 
data/README.md CHANGED
@@ -114,19 +114,19 @@ For more usage details, see our detailed [documentation](#documentation).
114
114
 
115
115
  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).
116
116
 
117
- Results using Ruby 3.2.2:
117
+ Results using Ruby 3.3.2:
118
118
 
119
119
  |Method arguments|`Dry::Core`\* (1.0.1)|`Memery` (1.5.0)|
120
120
  |--|--|--|
121
- |`()` (none)|0.66x|3.54x|
122
- |`(a)`|1.48x|8.49x|
123
- |`(a, b)`|1.18x|6.52x|
124
- |`(a:)`|1.53x|13.57x|
125
- |`(a:, b:)`|1.27x|10.56x|
126
- |`(a, b:)`|1.26x|10.44x|
127
- |`(a, *args)`|0.78x|1.60x|
128
- |`(a:, **kwargs)`|0.77x|2.12x|
129
- |`(a, *args, b:, **kwargs)`|0.69x|1.40x|
121
+ |`()` (none)|0.60x|3.17x|
122
+ |`(a)`|1.01x|7.94x|
123
+ |`(a, b)`|0.85x|6.38x|
124
+ |`(a:)`|1.00x|11.78x|
125
+ |`(a:, b:)`|0.88x|9.67x|
126
+ |`(a, b:)`|0.83x|9.44x|
127
+ |`(a, *args)`|0.67x|1.45x|
128
+ |`(a:, **kwargs)`|0.68x|1.88x|
129
+ |`(a, *args, b:, **kwargs)`|0.64x|1.29x|
130
130
 
131
131
  \* `Dry::Core`
132
132
  [may cause incorrect behavior caused by hash collisions](https://github.com/dry-rb/dry-core/issues/63).
@@ -180,7 +180,7 @@ versions:
180
180
 
181
181
  We maintain API documentation using [YARD](https://yardoc.org/), which is
182
182
  published automatically at
183
- [RubyDoc.info](https://rubydoc.info/gems/memo_wise).
183
+ [RubyDoc.info](https://rubydoc.info/gems/memo_wise).
184
184
 
185
185
  To generate documentation locally or run documentation tests,
186
186
  first install the `docs` dependencies (e.g. `yard`) as follows:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MemoWise
4
- VERSION = "1.9.0"
4
+ VERSION = "1.10.0"
5
5
  end
data/lib/memo_wise.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Disable RuboCop here because Ruby < 3.2 does not load `set` by default.
4
- require "set" # rubocop:disable Lint/RedundantRequireStatement
3
+ require "set" # Ruby < 3.2 does not load `set` by default.
5
4
 
6
5
  require "memo_wise/internal_api"
7
6
  require "memo_wise/version"
@@ -31,12 +30,12 @@ module MemoWise
31
30
  # [calling the original](https://medium.com/@jeremy_96642/ruby-method-auditing-using-module-prepend-4f4e69aacd95)
32
31
  # constructor.
33
32
  #
34
- # - **Q:** Why is [Module#prepend](https://ruby-doc.org/3.2.2/Module.html#method-i-prepend)
33
+ # - **Q:** Why is [Module#prepend](https://ruby-doc.org/3.3.1/Module.html#method-i-prepend)
35
34
  # important here
36
35
  # ([more info](https://medium.com/@leo_hetsch/ruby-modules-include-vs-prepend-vs-extend-f09837a5b073))?
37
36
  # - **A:** To set up *mutable state* inside the instance, even if the original
38
37
  # constructor will then call
39
- # [Object#freeze](https://ruby-doc.org/3.2.2/Object.html#method-i-freeze).
38
+ # [Object#freeze](https://ruby-doc.org/3.3.1/Object.html#method-i-freeze).
40
39
  #
41
40
  # This approach supports memoization on frozen (immutable) objects -- for
42
41
  # example, classes created by the
@@ -101,7 +100,7 @@ module MemoWise
101
100
  # @param target [Class]
102
101
  # The `Class` into to prepend the MemoWise methods e.g. `memo_wise`
103
102
  #
104
- # @see https://ruby-doc.org/3.2.2/Module.html#method-i-prepend
103
+ # @see https://ruby-doc.org/3.3.1/Module.html#method-i-prepend
105
104
  #
106
105
  # @example
107
106
  # class Example
@@ -116,7 +115,7 @@ module MemoWise
116
115
  #
117
116
  # This is necessary in addition to the `#initialize` method definition
118
117
  # above because
119
- # [`Class#allocate`](https://ruby-doc.org/3.2.2/Class.html#method-i-allocate)
118
+ # [`Class#allocate`](https://ruby-doc.org/3.3.1/Class.html#method-i-allocate)
120
119
  # bypasses `#initialize`, and when it's used (e.g.,
121
120
  # [in ActiveRecord](https://github.com/rails/rails/blob/a395c3a6af1e079740e7a28994d77c8baadd2a9d/activerecord/lib/active_record/persistence.rb#L411))
122
121
  # we still need to be able to access MemoWise's instance variable. Despite
@@ -268,7 +267,7 @@ module MemoWise
268
267
  )
269
268
  end
270
269
 
271
- # Override [Module#instance_method](https://ruby-doc.org/3.2.2/Module.html#method-i-instance_method)
270
+ # Override [Module#instance_method](https://ruby-doc.org/3.3.1/Module.html#method-i-instance_method)
272
271
  # to proxy the original `UnboundMethod#parameters` results. We want the
273
272
  # parameters to reflect the original method in order to support callers
274
273
  # who want to use Ruby reflection to process the method parameters,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memo_wise
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Panorama Education
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2024-06-04 00:00:00.000000000 Z
14
+ date: 2024-09-17 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description:
17
17
  email:
@@ -23,32 +23,12 @@ executables: []
23
23
  extensions: []
24
24
  extra_rdoc_files: []
25
25
  files:
26
- - ".dokaz"
27
- - ".github/PULL_REQUEST_TEMPLATE.md"
28
- - ".github/dependabot.yml"
29
- - ".github/workflows/dependency-review.yml"
30
- - ".github/workflows/main.yml"
31
- - ".gitignore"
32
- - ".rspec"
33
- - ".rubocop.yml"
34
- - ".ruby-version"
35
- - ".yardopts"
36
26
  - CHANGELOG.md
37
- - CODE_OF_CONDUCT.md
38
- - Gemfile
39
- - Gemfile.lock
40
27
  - LICENSE.txt
41
28
  - README.md
42
- - Rakefile
43
- - benchmarks/Gemfile
44
- - benchmarks/benchmarks.rb
45
- - bin/console
46
- - bin/setup
47
29
  - lib/memo_wise.rb
48
30
  - lib/memo_wise/internal_api.rb
49
31
  - lib/memo_wise/version.rb
50
- - logo/logo.png
51
- - memo_wise.gemspec
52
32
  homepage: https://github.com/panorama-ed/memo_wise
53
33
  licenses:
54
34
  - MIT
@@ -71,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
51
  - !ruby/object:Gem::Version
72
52
  version: '0'
73
53
  requirements: []
74
- rubygems_version: 3.4.10
54
+ rubygems_version: 3.5.9
75
55
  signing_key:
76
56
  specification_version: 4
77
57
  summary: The wise choice for Ruby memoization
data/.dokaz DELETED
@@ -1,2 +0,0 @@
1
- README.md
2
- --require ./spec/dokaz_helpers.rb
@@ -1,4 +0,0 @@
1
- **Before merging:**
2
-
3
- - [ ] Copy the table printed at the end of the latest benchmark results into the `README.md` and update this PR
4
- - [ ] If this change merits an update to `CHANGELOG.md`, add an entry following Keep a Changelog [guidelines](https://keepachangelog.com/en/1.0.0/) with [semantic versioning](https://semver.org/)
@@ -1,20 +0,0 @@
1
- version: 2
2
-
3
- updates:
4
- # Maintain dependencies for Ruby's Bundler
5
- - package-ecosystem: bundler
6
- directory: "/"
7
- schedule:
8
- interval: daily
9
-
10
- # Maintain dependencies for Ruby's Bundler (for Benchmarks!)
11
- - package-ecosystem: bundler
12
- directory: "/benchmarks"
13
- schedule:
14
- interval: daily
15
-
16
- # Maintain dependencies for GitHub Actions
17
- - package-ecosystem: "github-actions"
18
- directory: "/"
19
- schedule:
20
- interval: "daily"
@@ -1,23 +0,0 @@
1
- # Dependency Review Action
2
- #
3
- # This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
4
- #
5
- # Source repository: https://github.com/actions/dependency-review-action
6
- # Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
7
- name: 'Dependency Review'
8
- on: [pull_request]
9
-
10
- permissions:
11
- contents: read
12
-
13
- jobs:
14
- dependency-review:
15
- runs-on: ubuntu-latest
16
- steps:
17
- - name: 'Checkout Repository'
18
- uses: actions/checkout@v4
19
- - name: 'Dependency Review'
20
- uses: actions/dependency-review-action@v4
21
- with:
22
- # Possible values: "critical", "high", "moderate", "low"
23
- fail-on-severity: high
@@ -1,58 +0,0 @@
1
- name: Main
2
- on:
3
- pull_request:
4
- branches:
5
- - main
6
- push:
7
- branches:
8
- - main
9
- jobs:
10
- ci:
11
- name: CI
12
- strategy:
13
- fail-fast: false
14
- matrix:
15
- # Due to https://github.com/actions/runner/issues/849, we have to use
16
- # quotes for '3.0' -- without quotes, CI sees '3' and runs the latest.
17
- ruby: [2.5, 2.6, 2.7, '3.0', 3.1, 3.2, jruby, truffleruby-head]
18
- runs-on: ubuntu-latest
19
- steps:
20
- - uses: actions/checkout@v4
21
-
22
- # Conditionally configure bundler via environment variables as advised
23
- # * https://github.com/ruby/setup-ruby#bundle-config
24
- - name: Set bundler environment variables
25
- run: |
26
- echo "BUNDLE_WITH=checks:docs" >> $GITHUB_ENV
27
- if: matrix.ruby == 3.2
28
-
29
- # Use 'bundler-cache: true' instead of actions/cache as advised:
30
- # * https://github.com/actions/cache/blob/main/examples.md#ruby---bundler
31
- - uses: ruby/setup-ruby@v1
32
- with:
33
- ruby-version: ${{ matrix.ruby }}
34
- bundler-cache: true
35
-
36
- - run: bundle exec rspec
37
-
38
- - uses: codecov/codecov-action@v4
39
- with:
40
- files: ./coverage/coverage.xml
41
- fail_ci_if_error: true # optional (default = false)
42
- token: ${{ secrets.CODECOV_TOKEN }}
43
- verbose: true # optional (default = false)
44
- if: matrix.ruby == 3.2
45
-
46
- - run: bundle exec rubocop
47
- if: matrix.ruby == 3.2
48
-
49
- - run: |
50
- bundle exec yard doctest
51
- bundle exec dokaz
52
- if: matrix.ruby == 3.2
53
-
54
- - name: Run benchmarks on Ruby 2.7 or 3.2
55
- run: |
56
- BUNDLE_GEMFILE=benchmarks/Gemfile bundle install --jobs 4 --retry 3
57
- BUNDLE_GEMFILE=benchmarks/Gemfile bundle exec ruby benchmarks/benchmarks.rb
58
- if: matrix.ruby == '2.7' || matrix.ruby == '3.2'
data/.gitignore DELETED
@@ -1,16 +0,0 @@
1
- /.bundle/
2
- /benchmarks/.bundle/
3
- /benchmarks/Gemfile.lock
4
- /.yardoc
5
- /_yardoc/
6
- /coverage/
7
- /doc/
8
- /pkg/
9
- /spec/reports/
10
- /tmp/
11
-
12
- # rspec failure tracking
13
- .rspec_status
14
-
15
- # Jetbrains Rubymine IDE files
16
- .idea
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,17 +0,0 @@
1
- inherit_gem:
2
- panolint-ruby: panolint-ruby-rubocop.yml
3
-
4
- Layout/LineLength:
5
- Max: 120
6
-
7
- Metrics/ModuleLength:
8
- Enabled: false
9
-
10
- Metrics/PerceivedComplexity:
11
- Enabled: false
12
-
13
- Style/DocumentDynamicEvalDefinition:
14
- Enabled: false
15
-
16
- Style/MultipleComparison:
17
- Enabled: false
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.2.2
data/.yardopts DELETED
@@ -1,8 +0,0 @@
1
- --readme README.md
2
- --title 'MemoWise Documentation'
3
- --charset utf-8
4
- --markup markdown
5
- --plugin yard-doctest
6
- --no-private
7
- 'lib/**/*.rb' - '*.md'
8
- LICENSE.txt
data/CODE_OF_CONDUCT.md DELETED
@@ -1,76 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at engineering@panoramaed.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an
62
- incident. Further details of specific enforcement policies may be posted
63
- separately.
64
-
65
- Project maintainers who do not follow or enforce the Code of Conduct in good
66
- faith may face temporary or permanent repercussions as determined by other
67
- members of the project's leadership.
68
-
69
- ## Attribution
70
-
71
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
72
- version 1.4, available at
73
- [https://contributor-covenant.org/version/1/4][version]
74
-
75
- [homepage]: https://contributor-covenant.org
76
- [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- git_source(:github) { |repo| "https://github.com/#{repo}.git" }
6
-
7
- gemspec
8
-
9
- group :test do
10
- gem "rspec", "~> 3.13"
11
- gem "values", "~> 1"
12
- end
13
-
14
- # Excluded from CI except on latest MRI Ruby, to reduce compatibility burden
15
- group :checks, optional: true do
16
- gem "panolint-ruby", github: "panorama-ed/panolint-ruby", branch: "main"
17
-
18
- # Simplecov to generate coverage info
19
- gem "simplecov", require: false
20
-
21
- # Simplecov-cobertura to generate an xml coverage file to upload to Codecov
22
- gem "simplecov-cobertura", require: false
23
- end
24
-
25
- # Excluded from CI except on latest MRI Ruby, to reduce compatibility burden
26
- group :docs, optional: true do
27
- gem "dokaz", "~> 0.0.5"
28
- gem "redcarpet", "~> 3.6"
29
- gem "webrick", "~> 1.8"
30
- gem "yard", "~> 0.9"
31
- gem "yard-doctest", "~> 0.1"
32
- end
33
-
34
- # Optional, only used locally to release to rubygems.org
35
- group :release, optional: true do
36
- gem "rake"
37
- end
data/Gemfile.lock DELETED
@@ -1,113 +0,0 @@
1
- GIT
2
- remote: https://github.com/panorama-ed/panolint-ruby.git
3
- revision: a93988ea554177cf0ec9ef636c442f9d3af49a10
4
- branch: main
5
- specs:
6
- panolint-ruby (0)
7
- rubocop (= 1.51.0)
8
- rubocop-performance (= 1.18.0)
9
- rubocop-rspec (= 2.22.0)
10
-
11
- PATH
12
- remote: .
13
- specs:
14
- memo_wise (1.9.0)
15
-
16
- GEM
17
- remote: https://rubygems.org/
18
- specs:
19
- ansi (1.5.0)
20
- ast (2.4.2)
21
- diff-lcs (1.5.1)
22
- docile (1.4.0)
23
- dokaz (0.0.5)
24
- ansi
25
- rouge (~> 4)
26
- slop (~> 3)
27
- json (2.6.3)
28
- minitest (5.18.0)
29
- parallel (1.23.0)
30
- parser (3.2.2.1)
31
- ast (~> 2.4.1)
32
- rainbow (3.1.1)
33
- rake (13.1.0)
34
- redcarpet (3.6.0)
35
- regexp_parser (2.8.0)
36
- rexml (3.2.8)
37
- strscan (>= 3.0.9)
38
- rouge (4.1.0)
39
- rspec (3.13.0)
40
- rspec-core (~> 3.13.0)
41
- rspec-expectations (~> 3.13.0)
42
- rspec-mocks (~> 3.13.0)
43
- rspec-core (3.13.0)
44
- rspec-support (~> 3.13.0)
45
- rspec-expectations (3.13.0)
46
- diff-lcs (>= 1.2.0, < 2.0)
47
- rspec-support (~> 3.13.0)
48
- rspec-mocks (3.13.0)
49
- diff-lcs (>= 1.2.0, < 2.0)
50
- rspec-support (~> 3.13.0)
51
- rspec-support (3.13.1)
52
- rubocop (1.51.0)
53
- json (~> 2.3)
54
- parallel (~> 1.10)
55
- parser (>= 3.2.0.0)
56
- rainbow (>= 2.2.2, < 4.0)
57
- regexp_parser (>= 1.8, < 3.0)
58
- rexml (>= 3.2.5, < 4.0)
59
- rubocop-ast (>= 1.28.0, < 2.0)
60
- ruby-progressbar (~> 1.7)
61
- unicode-display_width (>= 2.4.0, < 3.0)
62
- rubocop-ast (1.28.1)
63
- parser (>= 3.2.1.0)
64
- rubocop-capybara (2.18.0)
65
- rubocop (~> 1.41)
66
- rubocop-factory_bot (2.23.1)
67
- rubocop (~> 1.33)
68
- rubocop-performance (1.18.0)
69
- rubocop (>= 1.7.0, < 2.0)
70
- rubocop-ast (>= 0.4.0)
71
- rubocop-rspec (2.22.0)
72
- rubocop (~> 1.33)
73
- rubocop-capybara (~> 2.17)
74
- rubocop-factory_bot (~> 2.22)
75
- ruby-progressbar (1.13.0)
76
- simplecov (0.22.0)
77
- docile (~> 1.1)
78
- simplecov-html (~> 0.11)
79
- simplecov_json_formatter (~> 0.1)
80
- simplecov-cobertura (2.1.0)
81
- rexml
82
- simplecov (~> 0.19)
83
- simplecov-html (0.12.3)
84
- simplecov_json_formatter (0.1.4)
85
- slop (3.6.0)
86
- strscan (3.1.0)
87
- unicode-display_width (2.4.2)
88
- values (1.8.0)
89
- webrick (1.8.1)
90
- yard (0.9.36)
91
- yard-doctest (0.1.17)
92
- minitest
93
- yard
94
-
95
- PLATFORMS
96
- ruby
97
-
98
- DEPENDENCIES
99
- dokaz (~> 0.0.5)
100
- memo_wise!
101
- panolint-ruby!
102
- rake
103
- redcarpet (~> 3.6)
104
- rspec (~> 3.13)
105
- simplecov
106
- simplecov-cobertura
107
- values (~> 1)
108
- webrick (~> 1.8)
109
- yard (~> 0.9)
110
- yard-doctest (~> 0.1)
111
-
112
- BUNDLED WITH
113
- 2.3.8
data/Rakefile DELETED
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
data/benchmarks/Gemfile DELETED
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- git_source(:github) { |repo| "https://github.com/#{repo}.git" }
6
-
7
- ruby ">= 2.7.7"
8
-
9
- gem "benchmark-ips", "2.13.0"
10
-
11
- if RUBY_VERSION > "3"
12
- gem "dry-core", "1.0.1"
13
- gem "memery", "1.5.0"
14
- else
15
- gem "ddmemoize", "1.0.0"
16
- gem "memoist", "0.16.2"
17
- gem "memoized", "1.1.1"
18
- gem "memoizer", "1.0.3"
19
- end
20
-
21
- gem "memo_wise", github: "panorama-ed/memo_wise", branch: "main"
@@ -1,274 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "benchmark/ips"
4
-
5
- require "tempfile"
6
-
7
- github_memo_wise_path = Gem.loaded_specs["memo_wise"].full_gem_path
8
-
9
- # This string is both used for temp filepaths necessary to separate the GitHub
10
- # version of MemoWise and the local version, and used for the reported results
11
- GITHUB_MAIN = "MemoWise_GitHubMain"
12
-
13
- # We download a the main branch of MemoWise on GitHub into a tmp directory to
14
- # compare against the local version when we run benchmarks
15
- Dir.mktmpdir do |directory|
16
- Dir["#{github_memo_wise_path}/lib/**/*.rb"].each do |file|
17
- Tempfile.open([File.basename(file)[0..-4], ".rb"], directory) do |tempfile|
18
- tempfile.write(File.read(file).gsub("MemoWise", GITHUB_MAIN))
19
- tempfile.rewind
20
- require tempfile.path
21
- end
22
- end
23
- end
24
-
25
- require_relative "../lib/memo_wise"
26
-
27
- # Some gems do not yet work in Ruby 3 so we only require them if they're loaded
28
- # in the Gemfile.
29
- %w[memery memoist memoized memoizer ddmemoize dry-core].
30
- each { |gem| require gem if Gem.loaded_specs.key?(gem) }
31
-
32
- # The VERSION constant does not get loaded above for these gems.
33
- %w[memoized memoizer].
34
- each { |gem| require "#{gem}/version" if Gem.loaded_specs.key?(gem) }
35
-
36
- # The Memoizable module from dry-core needs to be required manually
37
- require "dry/core/memoizable" if Gem.loaded_specs.key?("dry-core")
38
-
39
- class BenchmarkSuiteWithoutGC
40
- def warming(*)
41
- run_gc
42
- end
43
-
44
- def running(*)
45
- run_gc
46
- end
47
-
48
- def warmup_stats(*); end
49
-
50
- def add_report(*); end
51
-
52
- private
53
-
54
- def run_gc
55
- GC.enable
56
- GC.start
57
- GC.disable
58
- end
59
- end
60
- suite = BenchmarkSuiteWithoutGC.new
61
-
62
- BenchmarkGem = Struct.new(:klass, :activation_code, :memoization_method) do
63
- def benchmark_name
64
- "#{klass} (#{klass::VERSION})"
65
- end
66
- end
67
-
68
- # We alphabetize this list for easier readability, but shuffle the list before
69
- # using it to minimize the chance that our benchmarks are affected by ordering.
70
- # NOTE: Some gems do not yet work in Ruby 3 so we only test with them if they've
71
- # been `require`d.
72
- BENCHMARK_GEMS = [
73
- BenchmarkGem.new(MemoWise_GitHubMain, "prepend #{GITHUB_MAIN}", :memo_wise),
74
- BenchmarkGem.new(MemoWise, "prepend MemoWise", :memo_wise),
75
- (BenchmarkGem.new(DDMemoize, "DDMemoize.activate(self)", :memoize) if defined?(DDMemoize)),
76
- (BenchmarkGem.new(Dry::Core, "include Dry::Core::Memoizable", :memoize) if defined?(Dry::Core)),
77
- (BenchmarkGem.new(Memery, "include Memery", :memoize) if defined?(Memery)),
78
- (BenchmarkGem.new(Memoist, "extend Memoist", :memoize) if defined?(Memoist)),
79
- (BenchmarkGem.new(Memoized, "include Memoized", :memoize) if defined?(Memoized)),
80
- (BenchmarkGem.new(Memoizer, "include Memoizer", :memoize) if defined?(Memoizer))
81
- ].compact.shuffle
82
-
83
- # Use metaprogramming to ensure that each class is created in exactly the
84
- # the same way.
85
- BENCHMARK_GEMS.each do |benchmark_gem|
86
- eval <<~HEREDOC, binding, __FILE__, __LINE__ + 1 # rubocop:disable Security/Eval
87
- class #{benchmark_gem.klass}Example
88
- #{benchmark_gem.activation_code}
89
-
90
- def no_args
91
- 100
92
- end
93
- #{benchmark_gem.memoization_method} :no_args
94
-
95
- def one_positional_arg(a)
96
- 100
97
- end
98
- #{benchmark_gem.memoization_method} :one_positional_arg
99
-
100
- def positional_args(a, b)
101
- 100
102
- end
103
- #{benchmark_gem.memoization_method} :positional_args
104
-
105
- def one_keyword_arg(a:)
106
- 100
107
- end
108
- #{benchmark_gem.memoization_method} :one_keyword_arg
109
-
110
- def keyword_args(a:, b:)
111
- 100
112
- end
113
- #{benchmark_gem.memoization_method} :keyword_args
114
-
115
- def positional_and_keyword_args(a, b:)
116
- 100
117
- end
118
- #{benchmark_gem.memoization_method} :positional_and_keyword_args
119
-
120
- def positional_and_splat_args(a, *args)
121
- 100
122
- end
123
- #{benchmark_gem.memoization_method} :positional_and_splat_args
124
-
125
- def keyword_and_double_splat_args(a:, **kwargs)
126
- 100
127
- end
128
- #{benchmark_gem.memoization_method} :keyword_and_double_splat_args
129
-
130
- def positional_splat_keyword_and_double_splat_args(a, *args, b:, **kwargs)
131
- 100
132
- end
133
- #{benchmark_gem.memoization_method} :positional_splat_keyword_and_double_splat_args
134
- end
135
- HEREDOC
136
- end
137
-
138
- N_RESULT_DECIMAL_DIGITS = 2
139
-
140
- # Each method within these benchmarks is initially run once to memoize the
141
- # result value, so our benchmark only tests memoized retrieval time.
142
- benchmark_lambdas = [
143
- lambda do |x, instance, benchmark_gem|
144
- instance.no_args
145
-
146
- x.report("#{benchmark_gem.benchmark_name}: ()") do
147
- instance.no_args
148
- end
149
- end,
150
- lambda do |x, instance, benchmark_gem|
151
- instance.one_positional_arg(1)
152
-
153
- x.report("#{benchmark_gem.benchmark_name}: (a)") do
154
- instance.one_positional_arg(1)
155
- end
156
- end,
157
- lambda do |x, instance, benchmark_gem|
158
- instance.positional_args(1, 2)
159
-
160
- x.report("#{benchmark_gem.benchmark_name}: (a, b)") do
161
- instance.positional_args(1, 2)
162
- end
163
- end,
164
- lambda do |x, instance, benchmark_gem|
165
- instance.one_keyword_arg(a: 1)
166
-
167
- x.report("#{benchmark_gem.benchmark_name}: (a:)") do
168
- instance.one_keyword_arg(a: 1)
169
- end
170
- end,
171
- lambda do |x, instance, benchmark_gem|
172
- instance.keyword_args(a: 1, b: 2)
173
-
174
- x.report("#{benchmark_gem.benchmark_name}: (a:, b:)") do
175
- instance.keyword_args(a: 1, b: 2)
176
- end
177
- end,
178
- lambda do |x, instance, benchmark_gem|
179
- instance.positional_and_keyword_args(1, b: 2)
180
-
181
- x.report("#{benchmark_gem.benchmark_name}: (a, b:)") do
182
- instance.positional_and_keyword_args(1, b: 2)
183
- end
184
- end,
185
- lambda do |x, instance, benchmark_gem|
186
- instance.positional_and_splat_args(1, 2)
187
-
188
- x.report("#{benchmark_gem.benchmark_name}: (a, *args)") do
189
- instance.positional_and_splat_args(1, 2)
190
- end
191
- end,
192
- lambda do |x, instance, benchmark_gem|
193
- instance.keyword_and_double_splat_args(a: 1, b: 2)
194
-
195
- x.report("#{benchmark_gem.benchmark_name}: (a:, **kwargs)") do
196
- instance.keyword_and_double_splat_args(a: 1, b: 2)
197
- end
198
- end,
199
- lambda do |x, instance, benchmark_gem|
200
- instance.positional_splat_keyword_and_double_splat_args(1, 2, b: 3, a: 4)
201
-
202
- x.report("#{benchmark_gem.benchmark_name}: (a, *args, b:, **kwargs)") do
203
- instance.positional_splat_keyword_and_double_splat_args(1, 2, b: 3, a: 4)
204
- end
205
- end
206
- ]
207
-
208
- # We benchmark different cases separately, to ensure that slow performance in
209
- # one method or code path isn't hidden by fast performance in another.
210
- benchmark_jsons = benchmark_lambdas.map do |benchmark|
211
- json_file = Tempfile.new
212
-
213
- Benchmark.ips do |x|
214
- x.config(suite: suite)
215
- BENCHMARK_GEMS.each do |benchmark_gem|
216
- instance = Object.const_get("#{benchmark_gem.klass}Example").new
217
-
218
- benchmark.call(x, instance, benchmark_gem)
219
- end
220
-
221
- x.compare!
222
- x.json! json_file.path
223
- end
224
-
225
- JSON.parse(json_file.read)
226
- end
227
-
228
- [true, false].each do |github_comparison|
229
- benchmark_jsons.each_with_index do |benchmark_json, i|
230
- # We print a comparison table after we run each benchmark to copy into our
231
- # README.md
232
-
233
- # MemoWise will not appear in the comparison table, but we will use it to
234
- # compare against other gems' benchmarks
235
- memo_wise = benchmark_json.find { |json| json["name"].split.first == "MemoWise" }
236
- benchmark_json -= [memo_wise]
237
-
238
- github_main = benchmark_json.find { |json| json["name"].split.first == GITHUB_MAIN }
239
- benchmark_json = github_comparison ? [github_main] : benchmark_json - [github_main]
240
-
241
- # Sort benchmarks by gem name to alphabetize our final output table.
242
- benchmark_json.sort_by! { |json| json["name"] }
243
-
244
- # Print headers based on the first benchmark_json
245
- if i.zero?
246
- benchmark_headers = benchmark_json.map do |benchmark_gem|
247
- # Gem name is of the form:
248
- # "MemoWise (1.1.0): ()"
249
- # We use this mapping to get a header of the form
250
- # "`MemoWise` (1.1.0)
251
- gem_name_parts = benchmark_gem["name"].split
252
- "`#{gem_name_parts[0]}` #{gem_name_parts[1][...-1]}"
253
- end.join("|")
254
- puts "|Method arguments|#{benchmark_headers}|"
255
- puts "#{'|--' * (benchmark_json.size + 1)}|"
256
- end
257
-
258
- output_str = benchmark_json.map do |bgem|
259
- # "%.2f" % 12.345 => "12.34" (instead of "12.35")
260
- # See: https://bugs.ruby-lang.org/issues/12548
261
- # 1.00.round(2).to_s => "1.0" (instead of "1.00")
262
- #
263
- # So to round and format correctly, we first use Float#round and then %
264
- "%.#{N_RESULT_DECIMAL_DIGITS}fx" %
265
- (memo_wise["central_tendency"] / bgem["central_tendency"]).round(N_RESULT_DECIMAL_DIGITS)
266
- end.join("|")
267
-
268
- name = memo_wise["name"].partition(": ").last
269
- puts "|`#{name}`#{' (none)' if name == '()'}|#{output_str}|"
270
- end
271
-
272
- # Output a blank line between sections
273
- puts ""
274
- end
data/bin/console DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "bundler/setup"
5
- require "memo_wise"
6
-
7
- require "irb"
8
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
data/logo/logo.png DELETED
Binary file
data/memo_wise.gemspec DELETED
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/memo_wise/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "memo_wise"
7
- spec.version = MemoWise::VERSION
8
- spec.summary = "The wise choice for Ruby memoization"
9
- spec.homepage = "https://github.com/panorama-ed/memo_wise"
10
- spec.license = "MIT"
11
-
12
- spec.authors = [
13
- "Panorama Education",
14
- "Jacob Evelyn",
15
- "Jemma Issroff",
16
- "Marc Siegel",
17
- ]
18
-
19
- spec.email = [
20
- "engineering@panoramaed.com",
21
- "jacobevelyn@gmail.com",
22
- "jemmaissroff@gmail.com",
23
- "marc@usainnov.com",
24
- ]
25
-
26
- spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
27
-
28
- # Specify which files should be added to the gem when it is released.
29
- # The `git ls-files -z` loads the files in the RubyGem that have been added
30
- # into git.
31
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
32
- `git ls-files -z`.split("\x0").reject do |f|
33
- f.match(%r{^(test|spec|features)/})
34
- end
35
- end
36
- spec.require_paths = ["lib"]
37
-
38
- spec.metadata = {
39
- "rubygems_mfa_required" => "true",
40
- "changelog_uri" => "https://github.com/panorama-ed/memo_wise/blob/main/CHANGELOG.md",
41
- "source_code_uri" => "https://github.com/panorama-ed/memo_wise"
42
- }
43
- end