Shrink block bytecode vectors
commit2f997310eecbb945e457ba28766b56869beb4e00
authorShaunak Kishore <kshaunak@fb.com>
Thu, 25 Jun 2020 02:20:06 +0000 (24 19:20 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Wed, 1 Jul 2020 01:11:51 +0000 (30 18:11 -0700)
tree530193a068920eb2732e44d0bd7f6f1f3e836a90
parente00f4d9e8836eacfd29b29e844dc9c8bed9fdcd2
Shrink block bytecode vectors

Summary:
Shrink BytecodeVec at strategic points: a) when initially creating a Func and b) after each call to optimize. Note that we may lose out on a different memory optimization here: sharing bytecode between Funcs. I believe that because of the first shrink_to_fit, most of the time we'll only do the second when we have mutated (and COWed) the bytecode.

We also pre-size a couple of other vectors - the initializer_list constructor gets it right.

Reviewed By: ricklavoie

Differential Revision: D22214700

fbshipit-source-id: cc73913fc33a1db77072d0934003094887e89326
hphp/hhbbc/optimize.cpp
hphp/hhbbc/parse.cpp
hphp/util/compact-vector.h