[jit] Reclaim some binary size. (#68038)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/68038

Replace const std::function& to c10::function_ref because the former uses type erasure and adds 5-10 KB size overhead and adds another level of indirection to call the underlying functions. In contrast a non-owning c10::function_ref will just compile down to a raw function pointer which should be much smaller.
ghstack-source-id: 146670523

Test Plan: eyes

Reviewed By: iseeyuan, mrshenli

Differential Revision: D32264619

fbshipit-source-id: 558538fd882b8e1f4e72c4fd5e9d36d05f301e1e
This commit is contained in:
Zhengxu Chen
2022-01-07 11:19:15 -08:00
committed by Facebook GitHub Bot
parent dd1121435b
commit 0408449244
3 changed files with 4 additions and 3 deletions

View File

@ -307,7 +307,7 @@ struct SchemaParser {
int begin,
int sep,
int end,
const std::function<void()>& callback) {
c10::function_ref<void()> callback) {
auto r = L.cur().range;
if (begin != TK_NOTHING)
L.expect(begin);