diff options
author | Nobuyoshi Nakada <[email protected]> | 2020-11-29 15:01:41 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2020-11-29 15:01:41 +0900 |
commit | 02c32b2e9299726e20bb4499fa7c1f5430ce0b6d (patch) | |
tree | 3474373a4cbbe472e70c32657789d2f6327c0de2 /string.c | |
parent | 9c5d1a2964fb310f7ac024d74fa286e36f24ad49 (diff) |
Get rid of allocation when the capacity is small
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -1351,6 +1351,7 @@ rb_str_buf_new(long capa) { VALUE str = str_alloc(rb_cString); + if (capa <= RSTRING_EMBED_LEN_MAX) return str; if (capa < STR_BUF_MIN_SIZE) { capa = STR_BUF_MIN_SIZE; } |