diff options
| author | Jean Boussier <jean.boussier@gmail.com> | 2025-11-04 09:08:05 +0100 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-11-04 08:49:57 +0000 |
| commit | 7c924013630699321d51438f3754b291d8d4a37e (patch) | |
| tree | f34b08b243f563b97caabab0b053295daf3fa4a6 /ruby_parser.c | |
| parent | 157ae44b1e5f44d04e3dcb5cad4653e0f56e889d (diff) | |
[ruby/json] Micro-optimize `rstring_cache_fetch`
Closes: https://github.com/ruby/json/pull/888
- Mark it as `inline`.
- Use `RSTRING_GETMEM`, instead of `RSTRING_LEN` and `RSTRING_PTR`.
- Use an inlinable version of `memcmp`.
```
== Parsing activitypub.json (58160 bytes)
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Comparison:
before: 11766.6 i/s
after: 12272.1 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]
Comparison:
before: 1333.2 i/s
after: 1422.0 i/s - 1.07x 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]
Comparison:
before: 656.3 i/s
after: 673.1 i/s - 1.03x 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]
Comparison:
before: 276.8 i/s
after: 276.4 i/s - same-ish: difference falls within error
```
https://github.com/ruby/json/commit/a67d1a1af4
Co-Authored-By: Scott Myron <samyron@gmail.com>
Diffstat (limited to 'ruby_parser.c')
0 files changed, 0 insertions, 0 deletions
