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: ruby/json
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 49650f7
Choose a base ref
...
head repository: ruby/json
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d5e4a6e
Choose a head ref
  • 20 commits
  • 10 files changed
  • 6 contributors

Commits on Nov 6, 2024

  1. Configuration menu
    Copy the full SHA
    447a718 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #695 from MSP-Greg/00-ci-fix

    CI: ci.yml - update to actions/checkout@v4
    byroot authored Nov 6, 2024
    Configuration menu
    Copy the full SHA
    eb6de2f View commit details
    Browse the repository at this point in the history

Commits on Nov 7, 2024

  1. Configuration menu
    Copy the full SHA
    0d5ac5b View commit details
    Browse the repository at this point in the history
  2. Merge pull request #699 from ruby/add-dependabot-yaml

    Added automated update workflow for GitHub Actions
    hsbt authored Nov 7, 2024
    Configuration menu
    Copy the full SHA
    4c2433d View commit details
    Browse the repository at this point in the history
  3. Mark parser.c and Parser.java as generated files

    This way they're hidden in diffs.
    
    It would be good to enforce on CI that the generated files match
    the source change, however ragel's output isn't consistent
    across versions and system, so we'll have to rely on changes
    being noticed by further contributions.
    byroot committed Nov 7, 2024
    Configuration menu
    Copy the full SHA
    42bc089 View commit details
    Browse the repository at this point in the history
  4. Merge pull request #700 from casperisfine/mark-generated-files

    Mark parser.c and Parser.java as generated files
    byroot authored Nov 7, 2024
    Configuration menu
    Copy the full SHA
    1ecf7b4 View commit details
    Browse the repository at this point in the history
  5. Reduce comparisons when parsing numbers

    Before this commit, we would try to scan for a float, then if that
    failed, scan for an integer.  But floats and integers have many bytes in
    common, so we would end up scanning the same bytes multiple times.
    
    This patch combines integer and float scanning machines so that we only
    have to scan bytes once.  If the machine finds "float parts", then it
    executes the "isFloat" transition in the machine, which sets a boolean
    letting us know that the parser found a float.
    
    If we didn't find a float, but we did match, then we know it's an int.
    tenderlove authored and byroot committed Nov 7, 2024
    Configuration menu
    Copy the full SHA
    0c0e093 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    e51e796 View commit details
    Browse the repository at this point in the history
  7. Merge pull request #698 from ruby/float-parsing

    Reduce comparisons when parsing numbers
    byroot authored Nov 7, 2024
    Configuration menu
    Copy the full SHA
    4be55b0 View commit details
    Browse the repository at this point in the history
  8. JSON.load_file: explictly load the file as UTF-8

    Fix: #697
    
    This way even if `Encoding.default_external` is set to a weird value
    the document will be parsed just fine.
    byroot committed Nov 7, 2024
    Configuration menu
    Copy the full SHA
    3a8505a View commit details
    Browse the repository at this point in the history
  9. Merge pull request #702 from casperisfine/load-file-utf8

    JSON.load_file: explictly load the file as UTF-8
    byroot authored Nov 7, 2024
    Configuration menu
    Copy the full SHA
    b1397e2 View commit details
    Browse the repository at this point in the history

Commits on Nov 8, 2024

  1. Benchmark Oj::Parser in a thread safe way

    The documentation state `Oj::Parser.usual` isn't thread safe:
    https://github.com/ohler55/oj/blob/c70bf4125b546bc7146840b15de36460d42b4dff/ext/oj/parser.c#L1507-L1513
    
    As such we shouldn't benchark it this way, but instantiate a new
    parser every time. Technically in real world scenarios you could
    create a pool of parsers and re-use them, but if it's not provided
    by the gem, I'm not sure we should go out of our way to do it.
    byroot committed Nov 8, 2024
    Configuration menu
    Copy the full SHA
    855563f View commit details
    Browse the repository at this point in the history
  2. Merge pull request #703 from casperisfine/oj-parser-thread-safe

    Benchmark `Oj::Parser` in a thread safe way
    byroot authored Nov 8, 2024
    Configuration menu
    Copy the full SHA
    821b92e View commit details
    Browse the repository at this point in the history

Commits on Nov 11, 2024

  1. Fix $VERBOSE restore

    tompng committed Nov 11, 2024
    Configuration menu
    Copy the full SHA
    6ae9155 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #704 from tompng/test_verbose_fix

    Fix $VERBOSE restore
    byroot authored Nov 11, 2024
    Configuration menu
    Copy the full SHA
    3a09ad1 View commit details
    Browse the repository at this point in the history

Commits on Nov 13, 2024

  1. Only use the key cache if the Hash is in an Array

    Otherwise the likeliness of seeing that key again is really low, and looking up
    the cache is just a waste.
    
    Before:
    
    ```
    == Parsing small hash (65 bytes)
    ruby 3.4.0dev (2024-11-13T12:32:57Z fstr-update-callba.. 9b44b455b3) +YJIT +PRISM [arm64-darwin24]
    Warming up --------------------------------------
                    json   343.049k i/100ms
                      oj   213.943k i/100ms
              Oj::Parser    31.583k i/100ms
               rapidjson   303.433k i/100ms
    Calculating -------------------------------------
                    json      3.704M (± 1.5%) i/s  (270.01 ns/i) -     18.525M in   5.003078s
                      oj      2.200M (± 1.1%) i/s  (454.46 ns/i) -     11.125M in   5.056526s
              Oj::Parser    285.369k (± 4.8%) i/s    (3.50 μs/i) -      1.453M in   5.103866s
               rapidjson      3.216M (± 1.6%) i/s  (310.95 ns/i) -     16.082M in   5.001973s
    
    Comparison:
                    json:  3703517.4 i/s
               rapidjson:  3215983.0 i/s - 1.15x  slower
                      oj:  2200417.1 i/s - 1.68x  slower
              Oj::Parser:   285369.1 i/s - 12.98x  slower
    
    == Parsing test from oj (258 bytes)
    ruby 3.4.0dev (2024-11-13T12:32:57Z fstr-update-callba.. 9b44b455b3) +YJIT +PRISM [arm64-darwin24]
    Warming up --------------------------------------
                    json    54.539k i/100ms
                      oj    41.473k i/100ms
              Oj::Parser    24.064k i/100ms
               rapidjson    51.466k i/100ms
    Calculating -------------------------------------
                    json    549.386k (± 1.6%) i/s    (1.82 μs/i) -      2.781M in   5.064316s
                      oj    417.003k (± 1.3%) i/s    (2.40 μs/i) -      2.115M in   5.073047s
              Oj::Parser    226.500k (± 4.7%) i/s    (4.42 μs/i) -      1.131M in   5.005466s
               rapidjson    526.124k (± 1.0%) i/s    (1.90 μs/i) -      2.676M in   5.087176s
    
    Comparison:
                    json:   549385.6 i/s
               rapidjson:   526124.3 i/s - 1.04x  slower
                      oj:   417003.4 i/s - 1.32x  slower
              Oj::Parser:   226500.4 i/s - 2.43x  slower
    ```
    
    After:
    
    ```
    == Parsing small hash (65 bytes)
    ruby 3.4.0dev (2024-11-13T12:32:57Z fstr-update-callba.. 9b44b455b3) +YJIT +PRISM [arm64-darwin24]
    Warming up --------------------------------------
                    json   361.394k i/100ms
                      oj   217.203k i/100ms
              Oj::Parser    28.855k i/100ms
               rapidjson   303.404k i/100ms
    Calculating -------------------------------------
                    json      3.859M (± 2.9%) i/s  (259.13 ns/i) -     19.515M in   5.061302s
                      oj      2.191M (± 1.6%) i/s  (456.49 ns/i) -     11.077M in   5.058043s
              Oj::Parser    315.132k (± 7.1%) i/s    (3.17 μs/i) -      1.587M in   5.065707s
               rapidjson      3.156M (± 4.0%) i/s  (316.88 ns/i) -     15.777M in   5.008949s
    
    Comparison:
                    json:  3859046.5 i/s
               rapidjson:  3155778.5 i/s - 1.22x  slower
                      oj:  2190616.0 i/s - 1.76x  slower
              Oj::Parser:   315132.4 i/s - 12.25x  slower
    
    == Parsing test from oj (258 bytes)
    ruby 3.4.0dev (2024-11-13T12:32:57Z fstr-update-callba.. 9b44b455b3) +YJIT +PRISM [arm64-darwin24]
    Warming up --------------------------------------
                    json    55.682k i/100ms
                      oj    40.343k i/100ms
              Oj::Parser    25.119k i/100ms
               rapidjson    51.500k i/100ms
    Calculating -------------------------------------
                    json    555.808k (± 1.4%) i/s    (1.80 μs/i) -      2.784M in   5.010092s
                      oj    412.283k (± 1.7%) i/s    (2.43 μs/i) -      2.098M in   5.089900s
              Oj::Parser    279.306k (±13.3%) i/s    (3.58 μs/i) -      1.356M in   5.022079s
               rapidjson    517.177k (± 2.7%) i/s    (1.93 μs/i) -      2.626M in   5.082352s
    
    Comparison:
                    json:   555808.3 i/s
               rapidjson:   517177.1 i/s - 1.07x  slower
                      oj:   412283.2 i/s - 1.35x  slower
              Oj::Parser:   279306.5 i/s - 1.99x  slower
    ```
    byroot committed Nov 13, 2024
    Configuration menu
    Copy the full SHA
    00c45dd View commit details
    Browse the repository at this point in the history
  2. Merge pull request #705 from casperisfine/key-cache-in-array-only

    Only use the key cache if the Hash is in an Array
    byroot authored Nov 13, 2024
    Configuration menu
    Copy the full SHA
    d0dae8f View commit details
    Browse the repository at this point in the history

Commits on Nov 14, 2024

  1. Configuration menu
    Copy the full SHA
    61f022d View commit details
    Browse the repository at this point in the history
  2. Merge pull request #706 from YuheiNakasaka/fix-redundant-to_str

    Fix redundant to_str call in JSON.[] method
    byroot authored Nov 14, 2024
    Configuration menu
    Copy the full SHA
    72bea9d View commit details
    Browse the repository at this point in the history
  3. Release 2.8.2

    byroot committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    d5e4a6e View commit details
    Browse the repository at this point in the history
Loading