From 191025cc96b2f72dd893619b7d296001609c168d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 21 Nov 2022 16:58:19 -0700 Subject: [PATCH] [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%). --- src/hb-subset-cff-common.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-subset-cff-common.hh b/src/hb-subset-cff-common.hh index 7ec979c76..a17ad7528 100644 --- a/src/hb-subset-cff-common.hh +++ b/src/hb-subset-cff-common.hh @@ -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 ())