diff options
author | Jean Boussier <[email protected]> | 2024-09-03 09:38:18 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2024-09-03 12:21:36 +0200 |
commit | b7fa2dd0d0b7328f8f713b7cf0332d1e34c20fe4 (patch) | |
tree | a4ac16a74fbe895602302b3950efaaa8db4464ed /ast.c | |
parent | 245ed2fc890f7f33526e1c0f42b79c30366493e6 (diff) |
rb_enc_str_asciionly_p: avoid always fetching the encoding
Profiling of `JSON.dump` shows a significant amount of time spent
in `rb_enc_str_asciionly_p`, in large part because it fetches the
encoding.
It can be made twice as fast in this scenario by first checking the
coderange and only falling back to fetching the encoding if the
coderange is unknown.
Additionally we can skip fetching the encoding for the common
popular encodings.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11533
Diffstat (limited to 'ast.c')
0 files changed, 0 insertions, 0 deletions