517 Commits

Author SHA1 Message Date
Jean Boussier
d0fdbef4ea [ruby/json] Improve consistency of code style
https://github.com/ruby/json/commit/a497c71960
2025-07-07 11:53:23 +09:00
Nobuyoshi Nakada
9d080765cc [ruby/json] Run have_func with the header providing the declarations
https://github.com/ruby/json/commit/95fb084027
2025-07-01 20:28:47 +09:00
Jean Boussier
ae605b652d [ruby/json] Stop calling __builtin_cpu_init
It's only needed if using GCC `ifunc` mecanism, which
we don't.

https://github.com/ruby/json/commit/d3317b9f82
2025-07-01 20:28:45 +09:00
Takashi Kokubun
9f14857418 [ruby/json] Suppress -Wunused-function
https://github.com/ruby/json/commit/94ed471814
2025-07-01 15:35:37 +09:00
Nobuyoshi Nakada
8a2210b351 [ruby/json] Refactor simd/conf.rb - duplicate code
Integrate duplicate code by extracting headers, types and
initialization code.

https://github.com/ruby/json/commit/1a768d9179
2025-07-01 15:35:36 +09:00
Nobuyoshi Nakada
f909c907bb [ruby/json] Refactor simd/conf.rb - unnecessary have_type
Remove `have_type` calls because the next `try_compile` calls check
those types.

https://github.com/ruby/json/commit/b08e1ca2c1
2025-07-01 15:35:35 +09:00
Nobuyoshi Nakada
7d9c3004cf [ruby/json] Refactor simd/conf.rb - conditions to enable
See the results of `have_type` and `try_compile` in addition to
`have_header` for NEON as well as x86_64.  The former results were
just ignored, and `HAVE_TYPE_` macros are unused too.

https://github.com/ruby/json/commit/fdbb6062c2
2025-07-01 15:35:35 +09:00
Nobuyoshi Nakada
a9e2a818bd [ruby/json] Refactor simd/conf.rb - balance
Align code for arm and x86_64 in parallel.

https://github.com/ruby/json/commit/2211e30a59
2025-07-01 15:35:34 +09:00
Nobuyoshi Nakada
60eb1d5d23 [ruby/json] Refactor simd/conf.rb - compiler warnings
Suppress warnings for old style function definition and unused
variable.

https://github.com/ruby/json/commit/58dc0aa938
2025-07-01 15:35:33 +09:00
Nobuyoshi Nakada
91d5db5505 [ruby/json] Use load simd/conf.rb
When both extconf.rb of generator and parser are run in one process,
the second `require_relative` does nothing.

https://github.com/ruby/json/commit/8e775320b7
2025-07-01 15:35:32 +09:00
Hiroshi SHIBATA
5ee6315704 Use Dir.glob and base keyword arg for the installer of Ruby package 2025-07-01 11:50:11 +09:00
Nobuyoshi Nakada
400793426a [ruby/json] Remove trailing spaces [ci skip]
https://github.com/ruby/json/commit/68ee9cf188
2025-07-01 00:43:41 +09:00
Hiroshi SHIBATA
54cb133eea ruby tool/update-deps --fix 2025-06-30 12:56:50 +09:00
Hiroshi SHIBATA
43d27eb129 Adjust ruby/ruby directory structure 2025-06-30 12:56:50 +09:00
Jean Boussier
bc334be4db [ruby/json] Reduce duplication in extconf.rb
https://github.com/ruby/json/commit/3ae3eeb9d3
2025-06-30 12:56:50 +09:00
Scott Myron
50b6cd409a Optimize 'json_parse_string' using SIMD. 2025-06-30 12:56:50 +09:00
Nobuyoshi Nakada
ac02bf2b72 [ruby/json] Remove trailing spaces [ci skip]
https://github.com/ruby/json/commit/6c41162522
2025-06-24 18:19:04 +09:00
Jean Boussier
93fc29c65c
[ruby/json] Deprecate duplicate keys in object
There are few legitimate use cases for duplicate keys, and can
in some case be exploited.

Rather to always silently accept them, we should emit a warning,
and in the future require to explictly allow them.

https://github.com/ruby/json/commit/06f00a42e8
2025-06-24 12:10:50 +09:00
Jean Boussier
b310e7b3c7
[ruby/json] Add missing parser options documentation
https://github.com/ruby/json/commit/eed753ffde
2025-06-24 12:10:50 +09:00
Nobuyoshi Nakada
e9d35671d2 [ruby/json] Fix a typo
ruby/ruby#13636

https://github.com/ruby/json/commit/6fc2c4b6ab

Co-Authored-By: Tim Smith <tsmith84@gmail.com>
2025-06-17 17:45:40 +09:00
Jean Boussier
d565d809af
[ruby/json] Release 2.12.2
https://github.com/ruby/json/commit/a29cb77d52
2025-05-26 11:46:12 +09:00
Jean Boussier
54a314233c
[ruby/json] Release 2.12.1
https://github.com/ruby/json/commit/8603a57a91
2025-05-26 11:46:12 +09:00
Jean Boussier
212213a552
[ruby/json] fbuffer.c: add debug mode with bound checks.
This would have caught https://github.com/ruby/json/pull/808
on CI.

https://github.com/ruby/json/commit/8109421fb4
2025-05-26 11:46:12 +09:00
Jean Boussier
f171a263f7
[ruby/json] Fix: generate_json_float to reserve enough memory for large negative floats.
Fix: https://github.com/ruby/json/issues/807

Since https://github.com/ruby/json/pull/800, `fpconv_dtoa` can actually
generate up to 28 chars.

https://github.com/ruby/json/commit/d73ae93d3c
2025-05-26 11:46:12 +09:00
Jean Boussier
4759550967
[ruby/json] Remove some unnecessary top level constant lookups
https://github.com/ruby/json/commit/7c03ffc3e0
2025-05-19 11:19:17 +09:00
GrantBirki
e4a44b1f2a
[ruby/json] remove redundant self.
https://github.com/ruby/json/commit/c060943d04
2025-05-19 11:19:17 +09:00
GrantBirki
9b25023fe4
[ruby/json] use . over :: for consistency
https://github.com/ruby/json/commit/f5c1b8c45d
2025-05-19 11:19:17 +09:00
Cody Horton
3468811ed1
[ruby/json] fix for pretty_generate throwing wrong number of arguments error
https://github.com/ruby/json/commit/8433571dcf
2025-05-19 11:19:17 +09:00
Jean Boussier
cd7495a1d0 [ruby/json] Further improve parsing errors
Report EOF when applicable instead of an empty fragment.

Also stop fragment extraction on first whitespace.

https://github.com/ruby/json/commit/cc1daba860
2025-05-13 14:12:22 +09:00
Jean Boussier
8cc1aa82f1 [ruby/json] Add missing single quotes in error messages
https://github.com/ruby/json/commit/f3dde3cb2f
2025-05-13 14:12:22 +09:00
Jean Boussier
73d0bd5e90 [ruby/json] Release 2.12.0
https://github.com/ruby/json/commit/41f1f6939d
2025-05-13 14:12:22 +09:00
Jean Boussier
50ef208369 [ruby/json] parser.c: include line and column in error messages
https://github.com/ruby/json/commit/30e35b9ba5
2025-05-13 14:12:22 +09:00
Jean Boussier
8f008598c3 [ruby/json] parser.c: refactor raise_parse_error to have document start
https://github.com/ruby/json/commit/832b5b1a4c
2025-05-13 14:12:22 +09:00
Nobuyoshi Nakada
d2ffdb1088 Explicit cast down from double to int 2025-05-12 17:45:39 +09:00
Jean Boussier
af79914002 [ruby/json] Favor decimal notation over scientific notation for floats
e.g.
```
JSON.dump(1746861937.7842371)
```

master:
```
"1.https://github.com/ruby/json/commit/746861937784+9"
```

This branch and older json versions:
```
https://github.com/ruby/json/commit/1746861937.7842371
```

In the end it's shorter, and according to `canada.json` benchmark
performance is the same.

https://github.com/ruby/json/commit/866f72a437
2025-05-12 11:09:11 +09:00
Nobuyoshi Nakada
61b6f226e8
[ruby/json] Constify static data in fpconv.c
https://github.com/ruby/json/commit/3b605d9b1e
2025-05-08 18:03:04 +09:00
Jean Boussier
de6e59e5ba Sync ruby/json
Fix: https://github.com/ruby/json/issues/796
2025-05-01 10:06:04 +02:00
Jean Boussier
6e7825316e [ruby/json] Remove explicit include of extconf.h
https://github.com/ruby/json/commit/6b059900de

.
2025-04-30 08:12:41 +02:00
Jean Boussier
6ba0dc4d97 [ruby/json] Fix --with-static-linked-ext builds
https://github.com/ruby/json/commit/d7d60cccb0
2025-04-30 08:12:41 +02:00
Jean Boussier
338adad8ba [ruby/json] Fix i686 builds
We should test compilation with `-msse2` because we need to
test with whatever arguments Ruby will be compiled with.

https://github.com/ruby/json/commit/0a871365db
2025-04-30 08:12:41 +02:00
Jean Boussier
b5beed45a2 [ruby/json] SIMD: Match control char and double quote in one pass
`c < 32 || c == 34` is equivalent to `c ^ 2 < 33`.

Found in: https://lemire.me/blog/2025/04/13/detect-control-characters-quotes-and-backslashes-efficiently-using-swar/

The gain seem mostly present on micro-benchmark, and even there aren't
very consistent, but it's never slower.

```
== Encoding long string (124001 bytes)
ruby 3.4.2 (2025-02-15 revision https://github.com/ruby/json/commit/d2930f8e7a) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after     5.295k i/100ms
Calculating -------------------------------------
               after     55.796k (± 3.4%) i/s   (17.92 μs/i) -    280.635k in   5.035690s

Comparison:
              before:    49840.7 i/s
               after:    55795.8 i/s - 1.12x  faster
```

https://github.com/ruby/json/commit/034c5debd8
2025-04-30 08:12:41 +02:00
Jean Boussier
b7d1e33f26 Update ext/json/generator/depend 2025-04-30 08:12:41 +02:00
Scott Myron
a3ec53bbb0 [ruby/json] Introduce ARM Neon and SSE2 SIMD.
(https://github.com/ruby/json/pull/743)

See the pull request for the long development history: https://github.com/ruby/json/pull/743

```
== Encoding activitypub.json (52595 bytes)
ruby 3.4.2 (2025-02-15 revision https://github.com/ruby/json/commit/d2930f8e7a) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after     2.913k i/100ms
Calculating -------------------------------------
               after     29.377k (± 2.0%) i/s   (34.04 μs/i) -    148.563k in   5.059169s

Comparison:
              before:    23314.1 i/s
               after:    29377.3 i/s - 1.26x  faster

== Encoding citm_catalog.json (500298 bytes)
ruby 3.4.2 (2025-02-15 revision https://github.com/ruby/json/commit/d2930f8e7a) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after   152.000 i/100ms
Calculating -------------------------------------
               after      1.569k (± 0.8%) i/s  (637.49 μs/i) -      7.904k in   5.039001s

Comparison:
              before:     1485.6 i/s
               after:     1568.7 i/s - 1.06x  faster

== Encoding twitter.json (466906 bytes)
ruby 3.4.2 (2025-02-15 revision https://github.com/ruby/json/commit/d2930f8e7a) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after   309.000 i/100ms
Calculating -------------------------------------
               after      3.115k (± 3.1%) i/s  (321.01 μs/i) -     15.759k in   5.063776s

Comparison:
              before:     2508.3 i/s
               after:     3115.2 i/s - 1.24x  faster
```

https://github.com/ruby/json/commit/49003523da
2025-04-30 08:12:41 +02:00
Jean Boussier
7f0c6d30d3 [ruby/json] Use RB_TYPE_P
https://github.com/ruby/json/commit/b14250f1da
2025-04-30 08:12:41 +02:00
Jean Boussier
5566a7f740 [ruby/json] Handle non-string keys returning immediate values via to_s
We can't directly call `RBASIC_CLASS` as the return value of
`to_s` may be an immediate.

https://github.com/ruby/json/commit/12dc394d11
2025-04-30 08:12:41 +02:00
Jean Boussier
1103611600 [ruby/json] Release 2.11.3
https://github.com/ruby/json/commit/3e025f76d7
2025-04-30 08:12:41 +02:00
Jean Boussier
8fe3fb5d5a [ruby/json] Stop caching the generator state pointer
Fix: https://github.com/ruby/json/issues/790

If we end up calling something that spills the state
on the heap, the pointer we received is outdated and
may be out of sync.

https://github.com/ruby/json/commit/2ffa4ea46b
2025-04-30 08:12:41 +02:00
Jean Boussier
db66038285 [ruby/json] Release 2.11.2
https://github.com/ruby/json/commit/c985e8c6ea
2025-04-25 11:11:22 +09:00
Jean Boussier
05f949ebbf [ruby/json] Bring back JSON::PRETTY_STATE_PROTOTYPE with a deprecation
Fix: https://github.com/ruby/json/issues/788

`multi_json` rely on it, even though it was never documented as
public API.

Bringing it back as a method so it can emit a deprecation warning.

https://github.com/ruby/json/commit/123121bba2
2025-04-25 11:11:21 +09:00
Jean Boussier
1d65d5ce47 [ruby/json] Release 2.11.1
https://github.com/ruby/json/commit/84443e881d
2025-04-25 11:11:20 +09:00