[Misc #21768] Remove deprecated APIs#15447
Conversation
|
Nice. |
2af2aa0 to
0386f2b
Compare
Fix the use of deprecated C API ruby/ruby#15447
|
If you decide to merge this PR, please consider merging ruby/ruby-bench#455 to fix the ruby-bench CI. You should have write permission on the repository. |
6c10d2e to
a4c9d23
Compare
a4c9d23 to
b5092d2
Compare
cf93ac6 to
4cb105e
Compare
This comment has been minimized.
This comment has been minimized.
eecbe6c to
9379804
Compare
|
Nice to see that Ruby is cleaning up deprecated and old methods. I love Ruby, but there is a bit of cruft in the stdlib, so nice to see some of it go away (still more things that I think could be cut, so that effort can instead be spent on making the frequently used parts of the stdlib more ergonomic, better documented, etc). |
464a638 to
7ce6eda
Compare
|
Can you please merge this PR early in the release cycle? There are quite some gems out there which still use the untyped data API. I have at least 2 actively maintained gems, which still makes use of it: "fxruby" and "pkcs11". |
b402fa3 to
1a676ee
Compare
For the backward compatibility for some wrapper generator gems, keep only `RData` definition.
The old API was removed in ruby/ruby#15447 and the change will be released in ruby-4.1. Ruby-4.0 still supports the old untyped API.
This commit replaces the `yajl-ruby` dependency with Ruby's standard `json` gem for the following reasons: 1. Future Compatibility: `yajl-ruby` is no longer actively maintained and relies on internal C APIs that are removed in Ruby 4.1. Migrating to the standard `json` gem ensures the plugin can continue to be built and used in future Ruby environments. Ref. ruby/ruby#15447, brianmario/yajl-ruby#233 2. Performance: The standard `json` gem has seen significant improvements in recent updates and now outperforms `yajl-ruby`. ```ruby require 'bundler/inline' gemfile do source 'https://rubygems.org' gem 'benchmark-ips' gem 'yajl-ruby', require: 'yajl' gem 'json' end Benchmark.ips do |x| json = '{"a":"Alpha","b":true,"c":12345,"d":[true,[false,[-123456789,null],3.9676,["Something else.",false],null]],"e":{"zero":null,"one":1,"two":2,"three":[3],"four":[0,1,2,3,4]},"f":null,"h":{"a":{"b":{"c":{"d":{"e":{"f":{"g":null}}}}}}},"i":[[[[[[[null]]]]]]]}' x.report('Yajl.load') { Yajl.load(json) } x.report('JSON.parse') { JSON.parse(json) } x.compare! end ``` ``` ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +PRISM [x86_64-linux] Warming up -------------------------------------- Yajl.load 20.019k i/100ms JSON.parse 80.144k i/100ms Calculating ------------------------------------- Yajl.load 202.875k (± 0.2%) i/s (4.93 μs/i) - 1.021M in 5.032515s JSON.parse 808.103k (± 0.2%) i/s (1.24 μs/i) - 4.087M in 5.057949s Comparison: JSON.parse: 808103.0 i/s Yajl.load: 202874.5 i/s - 3.98x slower ```
The old API was removed in ruby/ruby#15447 and the change will be released in ruby-4.1. Ruby-4.0 still supports the old untyped API.
This commit replaces the `yajl-ruby` dependency with Ruby's standard `json` gem for the following reasons: 1. Future Compatibility: `yajl-ruby` is no longer actively maintained and relies on internal C APIs that are removed in Ruby 4.1. Migrating to the standard `json` gem ensures the plugin can continue to be built and used in future Ruby environments. Ref. ruby/ruby#15447, brianmario/yajl-ruby#233 2. Performance: The standard `json` gem has seen significant improvements in recent updates and now outperforms `yajl-ruby`. ```ruby require 'bundler/inline' gemfile do source 'https://rubygems.org' gem 'benchmark-ips' gem 'yajl-ruby', require: 'yajl' gem 'json' end Benchmark.ips do |x| json = '{"a":"Alpha","b":true,"c":12345,"d":[true,[false,[-123456789,null],3.9676,["Something else.",false],null]],"e":{"zero":null,"one":1,"two":2,"three":[3],"four":[0,1,2,3,4]},"f":null,"h":{"a":{"b":{"c":{"d":{"e":{"f":{"g":null}}}}}}},"i":[[[[[[[null]]]]]]]}' x.report('Yajl.load') { Yajl.load(json) } x.report('JSON.parse') { JSON.parse(json) } x.compare! end ``` ``` ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +PRISM [x86_64-linux] Warming up -------------------------------------- Yajl.load 20.019k i/100ms JSON.parse 80.144k i/100ms Calculating ------------------------------------- Yajl.load 202.875k (± 0.2%) i/s (4.93 μs/i) - 1.021M in 5.032515s JSON.parse 808.103k (± 0.2%) i/s (1.24 μs/i) - 4.087M in 5.057949s Comparison: JSON.parse: 808103.0 i/s Yajl.load: 202874.5 i/s - 3.98x slower ```
This commit replaces the `yajl-ruby` dependency with Ruby's standard `json` gem for the following reasons: 1. Future Compatibility: `yajl-ruby` is no longer actively maintained and relies on internal C APIs that are removed in Ruby 4.1. Migrating to the standard `json` gem ensures the plugin can continue to be built and used in future Ruby environments. Ref. ruby/ruby#15447, brianmario/yajl-ruby#233 2. Performance: The standard `json` gem has seen significant improvements in recent updates and now outperforms `yajl-ruby`. ```ruby require 'bundler/inline' gemfile do source 'https://rubygems.org' gem 'benchmark-ips' gem 'yajl-ruby', require: 'yajl' gem 'json' end Benchmark.ips do |x| json = '{"a":"Alpha","b":true,"c":12345,"d":[true,[false,[-123456789,null],3.9676,["Something else.",false],null]],"e":{"zero":null,"one":1,"two":2,"three":[3],"four":[0,1,2,3,4]},"f":null,"h":{"a":{"b":{"c":{"d":{"e":{"f":{"g":null}}}}}}},"i":[[[[[[[null]]]]]]]}' x.report('Yajl.load') { Yajl.load(json) } x.report('JSON.parse') { JSON.parse(json) } x.compare! end ``` ``` ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +PRISM [x86_64-linux] Warming up -------------------------------------- Yajl.load 20.019k i/100ms JSON.parse 80.144k i/100ms Calculating ------------------------------------- Yajl.load 202.875k (± 0.2%) i/s (4.93 μs/i) - 1.021M in 5.032515s JSON.parse 808.103k (± 0.2%) i/s (1.24 μs/i) - 4.087M in 5.057949s Comparison: JSON.parse: 808103.0 i/s Yajl.load: 202874.5 i/s - 3.98x slower ```
[Misc #21768]
ruby-bench tests failures are:
RDataUse typed data APIs gjtorikian/commonmarker#424lobstersvendored inruby-benchandcommonmarkerused by it are outdatedrb_postponed_job_register_one