[subset-cff] Really optimize op_str_t / parsed_cs_op_t layout

Now parsed_cs_op_t and op_str_t are both 16 bytes.

Saves another 7% in SourceHanSans/10000 benchmark.
This commit is contained in:
Behdad Esfahbod 2022-11-21 21:59:51 -07:00
parent 2d5ee23731
commit 28e767ddea
2 changed files with 9 additions and 5 deletions

View File

@ -480,12 +480,15 @@ struct arg_stack_t : cff_stack_t<ARG, 513>
/* an operator prefixed by its operands in a byte string */ /* an operator prefixed by its operands in a byte string */
struct op_str_t struct op_str_t
{ {
/* This used to be a hb_ubytes_t. Using a pointer and length /* This used to have a hb_ubytes_t. Using a pointer and length
* saves 8 bytes in the struct. */ * in a particular order, saves 8 bytes in this struct and more
* in our parsed_cs_op_t subclass. */
const unsigned char *ptr = nullptr; const unsigned char *ptr = nullptr;
unsigned length = 0;
op_code_t op; op_code_t op;
uint8_t length = 0;
}; };
/* base of OP_SERIALIZER */ /* base of OP_SERIALIZER */

View File

@ -309,12 +309,13 @@ struct parsed_cs_op_t : op_str_t
bool for_skip () const { return skip_flag; } bool for_skip () const { return skip_flag; }
void set_skip () { skip_flag = true; } void set_skip () { skip_flag = true; }
unsigned subr_num;
protected: protected:
bool drop_flag : 1; bool drop_flag : 1;
bool keep_flag : 1; bool keep_flag : 1;
bool skip_flag : 1; bool skip_flag : 1;
public:
uint16_t subr_num;
}; };
struct parsed_cs_str_t : parsed_values_t<parsed_cs_op_t> struct parsed_cs_str_t : parsed_values_t<parsed_cs_op_t>