Project

General

Profile

« Previous | Next » 

Revision b7fa2dd0

Added by byroot (Jean Boussier) about 1 year ago

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.