summaryrefslogtreecommitdiff
path: root/include/ruby/internal/error.h
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2025-04-28 15:23:48 +0200
committerJean Boussier <jean.boussier@gmail.com>2025-04-30 08:12:41 +0200
commitb5beed45a22265f9537d23717637f6067458c834 (patch)
treed14e9522710958b153f4f2e0c47108c051f1c2fd /include/ruby/internal/error.h
parentb7d1e33f26be7610df27d5c4538f443e81f986fa (diff)
[ruby/json] SIMD: Match control char and double quote in one pass
`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 https://github.com/ruby/json/commit/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 ``` https://github.com/ruby/json/commit/034c5debd8
Diffstat (limited to 'include/ruby/internal/error.h')
0 files changed, 0 insertions, 0 deletions