-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Update json gem #13194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update json gem #13194
Conversation
@kateinoigakukun Sorry for the ping, but I broke the WebAssembly build and I have no idea how to fix it:
Do you have any idea what I might be doing wrong? I assume it's in the |
77d3c00
to
bd9ca36
Compare
✅ All Tests passed!✖️no tests failed ✔️61941 tests passed(4 flakes) |
@byroot It looks like the problem is not specific for Wasm but tldr: Apply the following patch diff --git a/ext/json/generator/extconf.rb b/ext/json/generator/extconf.rb
index 374f95a1af..e44890e2ed 100644
--- a/ext/json/generator/extconf.rb
+++ b/ext/json/generator/extconf.rb
@@ -35,7 +35,5 @@
have_header('cpuid.h')
end
- create_header
-
create_makefile 'json/ext/generator'
end With Line 144 in 80a1a1b
So generated #ifndef EXTCONF_H
#define EXTCONF_H
#define JSON_GENERATOR 1
#define Init_generator Init_json_ext_generator
#define Init_generator Init_json_ext_generator
#define RUBY_EXPORT 1
#endif And However, the new |
That worked, thank you very much! |
Removing that
Edit: At least it does for me when after I pulled |
It's not just you. I pushed that change in |
I think removing the |
Yep, I believe that's correct. It seems like the After pulling master I see this:
|
d1c661c
to
48d63d6
Compare
Fix: ruby/json#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. ruby/json@2ffa4ea46b
We can't directly call `RBASIC_CLASS` as the return value of `to_s` may be an immediate. ruby/json@12dc394d11
(ruby/json#743) See the pull request for the long development history: ruby/json#743 ``` == Encoding activitypub.json (52595 bytes) ruby 3.4.2 (2025-02-15 revision ruby/json@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 ruby/json@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 ruby/json@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 ``` ruby/json@49003523da
`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 ruby/json@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 ``` ruby/json@034c5debd8
We should test compilation with `-msse2` because we need to test with whatever arguments Ruby will be compiled with. ruby/json@0a871365db
48d63d6
to
17bd5a5
Compare
17bd5a5
to
14ea134
Compare
Since there was a pretty big change with the introduction of SIMD code, I'm trying to check early if it cause any problem with Ruby rather than wait for Matzbot to discover it.