Optimize Typing_phase.localize for the common case of loading a class
commit995e021e3097528e493ae5ee13815be9ac6ef7a1
authorDwayne Reeves <dreeves@fb.com>
Fri, 10 Jul 2020 22:19:17 +0000 (10 15:19 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 10 Jul 2020 22:21:28 +0000 (10 15:21 -0700)
treec8a53a39de03542ac58d4fa026c92470cbaa69f0
parent9b88ae7872d1f07d70ea2f35e170e8875be5545c
Optimize Typing_phase.localize for the common case of loading a class

Summary: When localizing `Tapply`, we first check if it is a typedef using `Typing_env.is_typedef`. This will require fetching data from shared memory from the Naming_heap. I didn't think this was a big deal, since we also need to refer to the naming heap when resolving a class anyways. However there is a chance of saving some work if the class was already declared. In that case we would be able to fetch it the Classes heap, avoiding the cost completely of going to the Naming heap.

Reviewed By: andrewjkennedy

Differential Revision: D22461080

fbshipit-source-id: ce387b0cc37c5914269b1c6c91b0f9191e266619
hphp/hack/src/typing/typing_phase.ml