23 Commits
Author SHA1 Message Date
Hiroshi SHIBATAandClaude Opus 5.5 76f0a79179 [ruby/json] Drop the leftovers of runtime SSE2 detection
Neither the `__builtin_cpu_supports` probe in conf.rb nor `cpuid.h` has a use now that SSE2 is assumed on x86-64. The probe kept SIMD off on GCC older than 4.8, and the `HAVE_CPUID_H` guard broke builds that have `x86intrin.h` but not `cpuid.h` with a redefinition of `find_simd_implementation`.

https://github.com/ruby/json/commit/fae76b9eb4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 07:01:06 +00:00
Hiroshi SHIBATAandClaude Opus 5.5 2f88a23ad0 json: Use SSE2 on x86-64 without checking at runtime
__builtin_cpu_supports refers to __cpu_model in compiler-rt, which clang-cl does not link, so generator.so and parser.so failed with an undefined symbol. SSE2 is part of the x86-64 baseline, as NEON is for AArch64, where no check is made either.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 13:39:04 +09:00
Scott Myron 9aa3dc6f82 [ruby/json] Remove unused load_uint8x16_4 function.
https://github.com/ruby/json/commit/93bc1b3838
2026-02-25 07:24:42 +00:00
Jean Boussier 3164d4e8a2 [ruby/json] Extract json_fast_memcpy16 for readability
https://github.com/ruby/json/commit/1b276c8623
2026-01-16 17:52:54 +00:00
Scott Myron 456ef9140a [ruby/json] Use __builtin_memcpy, if available, to copy overlapping byte ranges in copy_remaining_bytes to avoid a branch to MEMCPY. Additionally use a space as padding byte instead of an 'X' so it can be represented diretly on AArch64 with a single instruction.
https://github.com/ruby/json/commit/643ee11fed
2026-01-16 17:52:54 +00:00
Nobuyoshi Nakada 28d9493b98 [ruby/json] Fix macro arguments
`ALWAYS_INLINE()` and `NOINLINE()` are defined with one argument.

https://github.com/ruby/json/commit/8fb727901e
2025-12-03 02:19:06 +00:00
Jean Boussier f1776e8f17 [ruby/json] Tentative fix for RHEL8 compiler
```
parser.c:87:77: error: missing binary operator before token "("
 #if JSON_CPU_LITTLE_ENDIAN_64BITS && defined(__has_builtin) && __has_builtin(__builtin_bswap64)
```

https://github.com/ruby/json/commit/fce1c7e84a
2025-11-04 11:07:31 +00:00
Jean Boussier 2f9e0d355e [ruby/json] Fix duplicate 'inline' declaration specifier
Followup: https://github.com/ruby/json/pull/889

https://github.com/ruby/json/commit/591510392a
2025-11-03 15:56:38 +00:00
Jean Boussier 35a5e55133 [ruby/json] Centralize macro definitions
https://github.com/ruby/json/commit/1576ea7d47
2025-11-03 09:22:40 +00:00
Jean Boussier 5384136eb5 [ruby/json] Enable JSON_DEBUG for parser/extconf.rb
https://github.com/ruby/json/commit/82b030f294
2025-11-01 14:35:23 +00:00
Jean BoussierandScott Myron ed7229eac8 [ruby/json] parser.c: Use SWAR to skip consecutive spaces
Closes: https://github.com/ruby/json/pull/881

If we encounter a newline, it is likely that the document is pretty printed,
hence that the newline is followed by multiple spaces.

In such case we can use SWAR to count up to eight consecutive spaces at once.

```
== Parsing activitypub.json (58160 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after     1.118k i/100ms
Calculating -------------------------------------
               after     11.223k (± 0.7%) i/s   (89.10 μs/i) -     57.018k in   5.080522s

Comparison:
              before:    10834.4 i/s
               after:    11223.4 i/s - 1.04x  faster

== Parsing twitter.json (567916 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after   118.000 i/100ms
Calculating -------------------------------------
               after      1.188k (± 1.0%) i/s  (841.62 μs/i) -      6.018k in   5.065355s

Comparison:
              before:     1094.8 i/s
               after:     1188.2 i/s - 1.09x  faster

== Parsing citm_catalog.json (1727030 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after    58.000 i/100ms
Calculating -------------------------------------
               after    570.506 (± 3.7%) i/s    (1.75 ms/i) -      2.900k in   5.091529s

Comparison:
              before:      419.6 i/s
               after:      570.5 i/s - 1.36x  faster

== Parsing float parsing (2251051 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Warming up --------------------------------------
               after    22.000 i/100ms
Calculating -------------------------------------
               after    212.010 (± 1.9%) i/s    (4.72 ms/i) -      1.078k in   5.086885s

Comparison:
              before:      189.4 i/s
               after:      212.0 i/s - 1.12x  faster
```

https://github.com/ruby/json/commit/b3fd7b26be

Co-Authored-By: Scott Myron <samyron@gmail.com>
2025-11-01 12:00:01 +00:00
Nobuyoshi Nakada 0adecf500a [ruby/json] Keep indentation consistent across functions [ci skip]
https://github.com/ruby/json/commit/1988a3ae4c
2025-07-27 16:35:14 +09:00
Nobuyoshi Nakada f5aee2480a [ruby/json] Functions defined in headers should be static inline
If `load_uint8x16_4` has an external linkage, it is defined in
both `generator` and `parser` extension libraries.  This duplicate
symbol causes a linker error when `--with-static-linked-ext` is
given, on some platforms.

https://github.com/ruby/json/commit/020693b17a
2025-07-27 15:08:19 +09:00
Jean Boussier 069a24c93c [ruby/json] Don't assume __builtin_cpu_supports exists
Fix: https://github.com/ruby/json/issues/827

On very old compilers it might not exist, at that point
might as well skip SIMD entirely.

https://github.com/ruby/json/commit/da878435dc
2025-07-25 11:11:23 +09:00
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
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
Hiroshi SHIBATA 43d27eb129 Adjust ruby/ruby directory structure 2025-06-30 12:56:50 +09:00