diff options
author | Jean Boussier <[email protected]> | 2025-01-03 19:41:08 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2025-01-07 13:21:46 +0900 |
commit | f756950d82dfd5049448a69f4fe4ddad5a7f7ff6 (patch) | |
tree | 1af940a8533b1f002e72785ea0a5bb6c47584e7e /spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb | |
parent | b176d4f52e4af67654814dab3e9c5f4bf9170e54 (diff) |
Improve lookup tables for string escaping.
Introduce a simplified table for the most common case, which is
`script_safe: false, ascii_only: false`.
On the `script_safe` table, now only `0xE2` does a multi-byte check.
Merge back `convert_ASCII_to_JSON`, as it no longer help much with
the simplified escape table.
```
== Encoding mixed utf8 (5003001 bytes)
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
after 38.000 i/100ms
Calculating -------------------------------------
after 398.220 (± 3.0%) i/s (2.51 ms/i) - 2.014k in 5.061659s
Comparison:
before: 381.8 i/s
after: 398.2 i/s - same-ish: difference falls within error
== Encoding mostly utf8 (5001001 bytes)
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
after 39.000 i/100ms
Calculating -------------------------------------
after 393.337 (± 2.5%) i/s (2.54 ms/i) - 1.989k in 5.059397s
Comparison:
before: 304.3 i/s
after: 393.3 i/s - 1.29x faster
== Encoding twitter.json (466906 bytes)
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
after 244.000 i/100ms
Calculating -------------------------------------
after 2.436k (± 0.9%) i/s (410.43 μs/i) - 12.200k in 5.007702s
Comparison:
before: 2125.9 i/s
after: 2436.5 i/s - 1.15x faster
```
Diffstat (limited to 'spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb')
0 files changed, 0 insertions, 0 deletions