| Age | Commit message (Collapse) | Author |
|
That call is surprisingly expensive, so trying doing it once
in `#synchronize` and then passing the EC to lock and unlock
saves quite a few cycles.
Before:
```
ruby 4.0.0dev (2025-12-10T09:30:18Z master c5608ab4d7) +YJIT +PRISM [arm64-darwin25]
Warming up --------------------------------------
Mutex 1.888M i/100ms
Monitor 1.633M i/100ms
Calculating -------------------------------------
Mutex 22.610M (± 0.2%) i/s (44.23 ns/i) - 113.258M in 5.009097s
Monitor 19.148M (± 0.3%) i/s (52.22 ns/i) - 96.366M in 5.032755s
```
After:
```
ruby 4.0.0dev (2025-12-10T10:40:07Z speedup-mutex 1c901cd4f8) +YJIT +PRISM [arm64-darwin25]
Warming up --------------------------------------
Mutex 2.095M i/100ms
Monitor 1.578M i/100ms
Calculating -------------------------------------
Mutex 24.456M (± 0.4%) i/s (40.89 ns/i) - 123.584M in 5.053418s
Monitor 19.176M (± 0.1%) i/s (52.15 ns/i) - 96.243M in 5.018977s
```
Bench:
```
require 'bundler/inline'
gemfile do
gem "benchmark-ips"
end
mutex = Mutex.new
require "monitor"
monitor = Monitor.new
Benchmark.ips do |x|
x.report("Mutex") { mutex.synchronize { } }
x.report("Monitor") { monitor.synchronize { } }
end
```
|
|
```
Run options:
"--ruby=./miniruby -I../ruby/lib -I. -I.ext/common ../ruby/tool/runruby.rb --extout=.ext -- --disable-gems"
--excludes-dir=../ruby/test/.excludes
--name=!/memory_leak/
--seed=9843
[ 1/31] TestTimeout#test_timeout_in_trap_handler = 0.00 s
1) Error:
TestTimeout#test_timeout_in_trap_handler:
NoMethodError: undefined method 'kill' for nil
/Users/luke/workspace/ruby-dev/ruby/test/test_timeout.rb:9:in 'TestTimeout#kill_timeout_thread'
/Users/luke/workspace/ruby-dev/ruby/test/test_timeout.rb:424:in 'TestTimeout#test_timeout_in_trap_handler'
Finished tests in 2.715032s, 11.4179 tests/s, 52.3014 assertions/s.
31 tests, 142 assertions, 0 failures, 1 errors, 0 skips
ruby -v: ruby 4.0.0dev (2025-12-11T21:56:23Z fix_timeout_test https://github.com/ruby/timeout/commit/1c5eacbf9a) +PRISM [arm64-darwin24]
make: *** [yes-test-all] Error 1
```
https://github.com/ruby/timeout/commit/e5bc1de901
|
|
Fix https://github.com/Shopify/ruby/issues/874
|
|
https://github.com/ruby/timeout/commit/c8d63ce3fe
|
|
|
|
Reads better to me:
> checking prerequisites for ZJIT... yes
|
|
|
|
There are many indentation styles for AS_CASE in this file but no one
uses `[*]` for the default case.
|
|
Windows has no SIGUSR1.
There might be another usable signal, but this is breaking ruby master
so I just want a quick fix for now.
https://github.com/ruby/timeout/commit/b19043e8d0
|
|
[[Misc #21770]](https://bugs.ruby-lang.org/issues/21770)
|
|
Help the compiler know that we always get a heap object here.
|
|
This rewrites the class allocator search to be faster. Instead of using
RCLASS_SUPER, which is now even slower due to Box, we can scan the
superclasses list to find a class where the allocator is defined.
This also disallows allocating from an ICLASS. Previously I believe that
was only done for FrozenCore, and that was changed in
e596cf6e93dbf121e197cccfec8a69902e00eda3.
|
|
This adds a fastpath in class_call_alloc_func to simply return if the
class matches the one expected.
I think we could probably just remove this check, or move it to the debug
build.
|
|
* test(set): add test Set#xor does not mutate other_set
* Fix Set#^ to not mutate its argument
|
|
This reverts commit https://github.com/ruby/json/commit/b7e1734d9ca0.
https://github.com/ruby/json/commit/5793694ee6
|
|
https://github.com/ruby/psych/commit/506bf75ab2
|
|
|
|
* Fixes https://github.com/ruby/timeout/issues/17
https://github.com/ruby/timeout/commit/1a499a8f96
|
|
https://github.com/ruby/timeout/commit/cb2ba88fed
|
|
https://github.com/ruby/timeout/commit/7cfa5a6778
|
|
* Add tests related to Thread.handle_interrupt
* Fixes https://github.com/ruby/timeout/issues/41
https://github.com/ruby/timeout/commit/a52720e82a
|
|
|
|
|
|
https://github.com/ruby/json/commit/1cdd2122d5
|
|
While it's not allowed by the spec, some parsers like Oj do
accept it, and it can be blocking a transition.
Having this feature can help people migrate.
https://github.com/ruby/json/commit/3459499cb3
|
|
|
|
|
|
This commit allows codes like `a b do end.()` and `a b do end&.()`.
|
|
Revert "Use base: with Dir.glob for bundler.gemspec"
This reverts commit 87f0701b6106569a8486c9623dc6b0b32438355c.
|
|
|
|
|
|
[Feature #21552]
Co-Authored-By: Claude <noreply@anthropic.com>
|
|
|
|
|
|
I believe this was accidentally left in as part of
2beb3798bac52624c3170138f8ef65869f1da6c0
|
|
Although the Ractor API is still experimental and may change, and there
may be some implementation issues, we should no longer say that there
are many.
Hopefully we can remove this warning entirely for Ruby 4.1
|
|
No point doing the manual size unit conversion for add. Sorry, no new
tests since there is no way to generate a LoadField with a negative
offset from ruby code AFAICT. Careful with the `as` casts.
|
|
So we don't expose builders to network flakiness which cannot be worked
around using cargo's --offline flag.
|
|
|
|
|
|
|
|
|
|
* ZJIT: Fold LoadField on frozen objects to constants
When accessing instance variables from frozen objects via attr_reader/
attr_accessor, fold the LoadField instruction to a constant at compile
time. This enables further optimizations like constant propagation.
- Add fold_getinstancevariable_frozen optimization in Function::optimize
- Check if receiver type has a known ruby_object() that is frozen
- Read the field value at compile time and replace with Const instruction
- Add 10 unit tests covering various value types (fixnum, string, symbol,
nil, true/false) and negative cases (unfrozen, dynamic receiver)
* Run zjit-test-update
* Add a test that we don't fold non-BasicObject
* Small cleanups
---------
Co-authored-by: Max Bernstein <ruby@bernsteinbear.com>
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
|
|
Generating an object_id for any type other than T_OBJECT (and T_CLASS)
will inevitably allocate an IMEMO/fields objects, which isn't supported
in a NEWOBJ tracepoint.
See: https://bugs.ruby-lang.org/issues/21710#note-23
|
|
|
|
|
|
Encodings are RTypedData, not the deprecated RData. Although the
structures are compatible we should use the correct API.
|
|
|
|
This fixes a crash when the new shape after a transition is too complex;
we need to check that it's not complex before trying to read by index.
|
|
|