-
Notifications
You must be signed in to change notification settings - Fork 25
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
Use attached_object in ruby 3.2+. #318
Conversation
d3f3b5b
to
6c08225
Compare
Thanks for making this change @alpaca-tc! This looks great. Since we only run code coverage analysis on the Ruby 3.2 tests, would you mind wrapping |
Added |
That's perfect, thanks! ❤️ If you would be willing to:
Results using Ruby 3.2.2:
|Method arguments|`Dry::Core`\* (1.0.1)|`Memery` (1.5.0)|
|--|--|--|
|`()` (none)|0.54x|3.62x|
|`(a)`|1.54x|7.74x|
|`(a, b)`|1.29x|5.58x|
|`(a:)`|1.55x|12.37x|
|`(a:, b:)`|1.15x|8.76x|
|`(a, b:)`|1.15x|8.75x|
|`(a, *args)`|0.84x|1.54x|
|`(a:, **kwargs)`|0.79x|2.13x|
|`(a, *args, b:, **kwargs)`|0.69x|1.38x|
\* `Dry::Core`
[may cause incorrect behavior caused by hash collisions](https://github.com/dry-rb/dry-core/issues/63).
Results using Ruby 2.7.8 (because these gems raise errors in Ruby 3.x):
|Method arguments|`DDMemoize` (1.0.0)|`Memoist` (0.16.2)|`Memoized` (1.1.1)|`Memoizer` (1.0.3)|
|--|--|--|--|--|
|`()` (none)|24.22x|2.42x|26.43x|2.70x|
|`(a)`|22.08x|15.19x|22.03x|13.67x|
|`(a, b)`|19.12x|14.01x|18.60x|12.80x|
|`(a:)`|30.21x|24.29x|26.43x|23.11x|
|`(a:, b:)`|27.73x|22.97x|25.11x|21.89x|
|`(a, b:)`|26.87x|22.76x|23.71x|21.26x|
|`(a, *args)`|3.15x|2.30x|3.18x|2.11x|
|`(a:, **kwargs)`|2.89x|2.40x|2.69x|2.28x|
|`(a, *args, b:, **kwargs)`|2.12x|1.82x|1.96x|1.74x|
I'll merge this and release a new version right away. |
b9a6986
to
56f6d6f
Compare
Codecov Report
@@ Coverage Diff @@
## main #318 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 177 179 +2
Branches 87 88 +1
=========================================
+ Hits 177 179 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
fixed 👍 |
Thanks so much @alpaca-tc and so sorry for the delay! This has now been released in v1.8.0. Thanks for being a contributor! |
In ruby 3.2+, the method
#attached_object
is available to search for object of the singleton class.It is more simple and faster than using ObjectSpace.
Before merging:
README.md
and update this PRCHANGELOG.md
, add an entry following Keep a Changelog guidelines with semantic versioning