Skip to content

Conversation

@myronmarston
Copy link
Collaborator

After upgrading, I got a couple of warnings/errors, as shown below.

W, [2025-12-30T18:29:38.165542 #27133]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.165641 #27133]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.944855 #27167]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.944864 #27169]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.944856 #27168]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.946018 #27170]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.945572 #27166]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.946532 #27171]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.953864 #27172]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.974222 #27173]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
....................................................................F...............................................................................................................................................................................................................................................................................................................................................................................................................................F........................................................................................................................

elasticgraph-graphql/lib/elastic_graph/graphql/decoded_cursor.rb:58:24: [error] The method is deprecated
│ Diagnostic ID: Ruby::DeprecatedReference
│
└           json = ::JSON.fast_generate(sort_values)
                          ~~~~~~~~~~~~~

elasticgraph-support/lib/elastic_graph/support/untyped_encoder.rb:36:15: [error] The method is deprecated
│ Diagnostic ID: Ruby::DeprecatedReference
│
└         ::JSON.fast_generate(canonicalize(value))
                 ~~~~~~~~~~~~~

Detected 2 problems from 2 files

After upgrading, I got a couple of warnings/errors, as shown below.

```
W, [2025-12-30T18:29:38.165542 #27133]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.165641 #27133]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.944855 #27167]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.944864 #27169]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.944856 #27168]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.946018 #27170]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.945572 #27166]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.946532 #27171]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.953864 #27172]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
W, [2025-12-30T18:29:38.974222 #27173]  WARN -- rbs: `pathname` has been moved to core library, so it is always loaded. Remove explicit loading `pathname`
....................................................................F...............................................................................................................................................................................................................................................................................................................................................................................................................................F........................................................................................................................

elasticgraph-graphql/lib/elastic_graph/graphql/decoded_cursor.rb:58:24: [error] The method is deprecated
│ Diagnostic ID: Ruby::DeprecatedReference
│
└           json = ::JSON.fast_generate(sort_values)
                          ~~~~~~~~~~~~~

elasticgraph-support/lib/elastic_graph/support/untyped_encoder.rb:36:15: [error] The method is deprecated
│ Diagnostic ID: Ruby::DeprecatedReference
│
└         ::JSON.fast_generate(canonicalize(value))
                 ~~~~~~~~~~~~~

Detected 2 problems from 2 files
```
Copy link
Collaborator

@jwils jwils left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was going to ask if any concerns with a performance regression switching to generate but it looks like it performs better with a trivial test to me

require 'benchmark'
require 'json'

small = {'a' => 1}
medium = {'a' => 1, 'b' => [1,2,3,4,5], 'c' => {'nested' => 'value', 'another' => [1,2,3]}}
large = (1..50).map { |i| [\"key_#{i}\", {value: i, data: [i, i*2, i*3]}] }.to_h

n = 50_000

puts 'Small payload:'
Benchmark.bm(15) do |x|
  x.report('generate:') { n.times { JSON.generate(small) } }
  x.report('fast_generate:') { n.times { JSON.fast_generate(small) } }
end

puts
puts 'Medium payload:'
Benchmark.bm(15) do |x|
  x.report('generate:') { n.times { JSON.generate(medium) } }
  x.report('fast_generate:') { n.times { JSON.fast_generate(medium) } }
end

puts
puts 'Large payload:'
Benchmark.bm(15) do |x|
  x.report('generate:') { n.times { JSON.generate(large) } }
  x.report('fast_generate:') { n.times { JSON.fast_generate(large) } }
end
     Small payload:
                           user     system      total        real
     generate:         0.006507   0.000105   0.006612 (  0.006615)
     fast_generate:    0.012983   0.000089   0.013072 (  0.013072)

     Medium payload:
                           user     system      total        real
     generate:         0.011832   0.000204   0.012036 (  0.012036)
     fast_generate:    0.018717   0.000027   0.018744 (  0.018748)

     Large payload:
                           user     system      total        real
     generate:         0.225075   0.002191   0.227266 (  0.227265)
     fast_generate:    0.235813   0.001284   0.237097 (  0.238688)

@myronmarston
Copy link
Collaborator Author

Was going to ask if any concerns with a performance regression switching to generate but it looks like it performs better with a trivial test to me

Thanks! I hadn't run a benchmark but I had seen this note in the ruby JSON gem changelog:

Deprecate JSON.fast_generate (it's not any faster, so pointless).

@myronmarston myronmarston merged commit d412d51 into main Jan 1, 2026
19 checks passed
@myronmarston myronmarston deleted the myron/update-rbs branch January 1, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants