Commit a67d1a1
Micro-optimize
Closes: #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 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 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 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 dbd83256b1) +YJIT +PRISM [arm64-darwin24]
Comparison:
before: 276.8 i/s
after: 276.4 i/s - same-ish: difference falls within error
```
Co-Authored-By: Scott Myron <samyron@gmail.com>rstring_cache_fetch
1 parent ddad00b commit a67d1a1
1 file changed
+39
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
| 88 | + | |
88 | 89 | | |
89 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
90 | 125 | | |
91 | | - | |
| 126 | + | |
92 | 127 | | |
93 | 128 | | |
94 | 129 | | |
95 | 130 | | |
96 | 131 | | |
97 | | - | |
| 132 | + | |
98 | 133 | | |
99 | 134 | | |
100 | 135 | | |
| |||
0 commit comments