json 2.11.2 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 747a457b1988cb2f8b166b6e0c228a3dca50b90a120a9128f815c4c18fb9f450
4
- data.tar.gz: cc3c446db01177c9f7fbc6409d19e69bebce3845c77a7e8a3542c783a728d8b2
3
+ metadata.gz: 8e71f977a9d4c1316007814d62236fd185f5aaade7a79f3e5d48a9ffde32f520
4
+ data.tar.gz: f1be8ac3136a6dcf48aa15c7ec08fa4dfcedb6f89b1b6ad8944727708a16e074
5
5
  SHA512:
6
- metadata.gz: ea235083ce6d28a891ca4b583a7cb36641e736bc776a7039ff59c919e21e5d3eae4b2baf254dc190de003cccc62a1e7a03ada668c97f3226c154d1e76a35b307
7
- data.tar.gz: 4818eaff0e54ef1402253bdca221c1262257314131733ac678338c8d8c8d447052dcf11205e309573b32ea9354717d3c485011739c8a7ab4c12af3391d7e2500
6
+ metadata.gz: 23f2d490dfb7ea60b189f8227787fde0c53844f62c8e9023ba1d413a72b46b7a3b77836d1a6050dd0a2fa925370bd260da0a52d738bd1231c81ad1ef4a17adda
7
+ data.tar.gz: 22326ad3f75f99e20c7f1ad3cc0f519ffc56b7c85c94aa124a2ea47c8d0c86f604307fe504f216b347651d3c82df83623798dbdbabc45be78a1e4721cc7b8cbe
data/CHANGES.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changes
2
2
 
3
+ ### Unreleased
4
+
5
+ ### 2025-05-12 (2.12.0)
6
+
7
+ * Improve floating point generation to not use scientific notation as much.
8
+ * Include line and column in parser errors. Both in the message and as exception attributes.
9
+ * Handle non-string hash keys with broken `to_s` implementations.
10
+ * `JSON.generate` now uses SSE2 (x86) or NEON (arm64) instructions when available to escape strings.
11
+
12
+ ### 2025-04-25 (2.11.3)
13
+
14
+ * Fix a regression in `JSON.pretty_generate` that could cause indentation to be off once some `#to_json` has been called.
15
+
3
16
  ### 2025-04-24 (2.11.2)
4
17
 
5
18
  * Add back `JSON::PRETTY_STATE_PROTOTYPE`. This constant was private API but is used by popular gems like `multi_json`.
@@ -6,5 +6,34 @@ if RUBY_ENGINE == 'truffleruby'
6
6
  else
7
7
  append_cflags("-std=c99")
8
8
  $defs << "-DJSON_GENERATOR"
9
+
10
+ if enable_config('generator-use-simd', default=!ENV["JSON_DISABLE_SIMD"])
11
+ if RbConfig::CONFIG['host_cpu'] =~ /^(arm.*|aarch64.*)/
12
+ # Try to compile a small program using NEON instructions
13
+ if have_header('arm_neon.h')
14
+ have_type('uint8x16_t', headers=['arm_neon.h']) && try_compile(<<~'SRC')
15
+ #include <arm_neon.h>
16
+ int main() {
17
+ uint8x16_t test = vdupq_n_u8(32);
18
+ return 0;
19
+ }
20
+ SRC
21
+ $defs.push("-DJSON_ENABLE_SIMD")
22
+ end
23
+ end
24
+
25
+ if have_header('x86intrin.h') && have_type('__m128i', headers=['x86intrin.h']) && try_compile(<<~'SRC')
26
+ #include <x86intrin.h>
27
+ int main() {
28
+ __m128i test = _mm_set1_epi8(32);
29
+ return 0;
30
+ }
31
+ SRC
32
+ $defs.push("-DJSON_ENABLE_SIMD")
33
+ end
34
+
35
+ have_header('cpuid.h')
36
+ end
37
+
9
38
  create_makefile 'json/ext/generator'
10
39
  end