[cff] Adjust buffer pre-allocation

Most ops take one or two bytes, so allocate count*2, not count*3.
Shows minor speedup in subsetting benchmark (around 2%).
This commit is contained in:
Behdad Esfahbod 2022-11-21 16:58:19 -07:00
parent 4b2caafea2
commit 191025cc96
1 changed files with 1 additions and 1 deletions

View File

@ -856,7 +856,7 @@ struct subr_subsetter_t
unsigned count = str.get_count ();
str_encoder_t encoder (buff);
encoder.reset ();
buff.alloc (count * 3);
buff.alloc (count * 2);
/* if a prefix (CFF1 width or CFF2 vsindex) has been removed along with hints,
* re-insert it at the beginning of charstreing */
if (str.has_prefix () && str.is_hint_dropped ())