Decrease size of BPos
commit9220a3f200d4c1a7bf2c16d9261c4d52a1f2b02d
authorJake Bailey (Hacklang) <jakebailey@fb.com>
Fri, 11 Feb 2022 17:29:37 +0000 (11 09:29 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 11 Feb 2022 17:34:35 +0000 (11 09:34 -0800)
tree09f5aaa24d10bfc8f8cdf40456708ce63f1b4127
parentb00493ac34ea79a5238e189159e29a3da073bfe0
Decrease size of BPos

Summary: Use the same bit-packing types used in hh_server, oxidized, and oxidized_by_ref (FilePosSmall and PosSpanTiny) to represent most positions in much less space. Decreases size_of::<PosImpl>() from 56 bytes to 16. 95% of positions fit in those 16 bytes (the Tiny variant). For positions that don't fit the Tiny variant, use the Small variant, which allocates 16 more bytes for two `FilePosSmall`s. For even larger positions, allocate 48 bytes for two `FilePosLarge`s.

Reviewed By: edwinsmith

Differential Revision: D34162388

fbshipit-source-id: 522072516aa3f7d71fb93580dc452740d7cae73e
hphp/hack/src/oxidized/manual/pos.rs
hphp/hack/src/oxidized/manual/relative_path.rs
hphp/hack/src/oxidized_by_ref/manual/pos.rs
hphp/hack/src/rupro/lib/alloc/alloc_pos.rs
hphp/hack/src/rupro/lib/pos/pos.rs
hphp/hack/src/rupro/lib/pos/relative_path.rs