Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mtsmfm/language_server-protocol-ruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.17.0.4
Choose a base ref
...
head repository: mtsmfm/language_server-protocol-ruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.17.0.5
Choose a head ref
  • 5 commits
  • 313 files changed
  • 3 contributors

Commits on May 11, 2025

  1. Use JSON.generate() instead to improve performance

    It seems it is more efficient using JSON.generate() instead of the #to_json method.
    
    ### benchmark
    ```ruby
    require 'bundler/inline'
    gemfile do
      source 'https://rubygems.org'
      gem 'benchmark-ips'
      gem 'json'
    end
    
    json =<<~JSON
    {
      "method": "$/steep/typecheck/progress",
      "params": {
        "guid": "8d4c15ce-33ad-40d8-bef4-8713f29cab5b",
        "path": "/home/watson/prj/gruff/lib/gruff/store/basic_data.rb",
        "target": "lib",
        "diagnostics": []
      },
      "jsonrpc": "2.0"
    }
    JSON
    
    data = JSON.parse(json)
    
    puts "** JSON version #{JSON::VERSION} **"
    
    Benchmark.ips do |x|
      x.report('to_json') { data.to_json }
      x.report('JSON.generate') { JSON.generate(data) }
    
      x.compare!
    end
    ```
    
    ### result
    ```sh
    $ ruby json.rb
    ** JSON version 2.11.3 **
    ruby 3.4.3 (2025-04-14 revision d0b7e5b6a0) +PRISM [x86_64-linux]
    Warming up --------------------------------------
                 to_json   293.738k i/100ms
           JSON.generate   335.385k i/100ms
    Calculating -------------------------------------
                 to_json      2.887M (± 1.4%) i/s  (346.41 ns/i) -     14.687M in   5.088761s
           JSON.generate      3.366M (± 1.0%) i/s  (297.10 ns/i) -     17.105M in   5.082281s
    
    Comparison:
           JSON.generate:  3365882.0 i/s
                 to_json:  2886757.9 i/s - 1.17x  slower
    ```
    
    ### environmet
    - OS: Manjaro Linux x86_64
    - Kernel: 6.14.4-1-MANJARO
    - Compiler: gcc 14.2.1 20250207
    - Ruby: ruby 3.4.3
    Watson1978 committed May 11, 2025
    Configuration menu
    Copy the full SHA
    69a5185 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7e6ca7a View commit details
    Browse the repository at this point in the history

Commits on May 12, 2025

  1. Merge pull request #115 from Watson1978/to_json

    Use JSON.generate() instead to improve performance
    mtsmfm authored May 12, 2025
    Configuration menu
    Copy the full SHA
    c7d8677 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #116 from tomoasleep/add-attribute-signature

    Generate RBS signatures of attribute method signatures
    mtsmfm authored May 12, 2025
    Configuration menu
    Copy the full SHA
    60c9aaa View commit details
    Browse the repository at this point in the history
  3. Release 3.17.0.5

    mtsmfm committed May 12, 2025
    Configuration menu
    Copy the full SHA
    174c0d1 View commit details
    Browse the repository at this point in the history
Loading