Terse Write Benchmark
Summary:
Create Terse Write Benchmark.
* `N` indicates # of fields.
* `struct_N`: all fields are unqualified
* `terse_struct_N_empty`: all fields are terse and empty
* `terse_struct_N_half_filled`: all fields are terse and half of fields are not empty
* `terse_struct_N_filled`: all fields are terse and not empty
* `terse_struct_N_first_element_nonempty`: all fields are terse. All fields except for the first field is empty.
* `terse_struct_N_middle_element_nonempty`: all fields are terse. All fields except for the middle field is empty.
* `terse_struct_N_last_element_nonempty`: all fields are terse. All fields except for the last field is empty.
Comparison:
* `struct_N` and `terse_struct_N_empty` compare performance empty terse struct.
* `struct_N` and `terse_struct_N_filled` compare performance of non-empty terse fields and overhead of empty check.
* `terse_struct_N` and `terse_struct_N_last_element_nonempty` compare the worst case empty check where duplicate empty check happens due to one non-empty field.
This shows terse write struct optimization actually penalize the sparse struct, and it is significantly worse for the low-level of nested structs.
Analysis:
* When N < 32, empty terse struct is more expensive since rewinding buffer is expensive.
Reviewed By: iahs
Differential Revision:
D41089722
fbshipit-source-id:
d17c6e6763632c498bb5d26a2b4ba5256d4c7341