Repository navigation
Commit cdafd94
committed
Build the occur walk's closure once per call
Why:
`occur_reaches` passed `occur_reaches budget ty0` to `iter_type_expr`
at every node, so the fast walk allocated a partial application per
node it visited.
`occur_reaches` now defines its walk once per call, capturing the budget
and the variable, as `deep_occur_fast_absent` already does. The edges it
follows and the exceptions it raises are unchanged.
Measured with scripts/compilerBenchmarks.js against the previous commit:
allocated words -1.58% in total, stress/TypeAliasChain.res -53%, Belt
and runtime files -2% to -2.7%. On a 552 module React app (clean build,
one domain) the build allocates 0.05% fewer words. A version that
returns a bool instead of raising allocated more than this one (-1.27%
in total), because `List.for_all` takes a closure per list.
Signed-off-by: Jono Prest <jjprest@gmail.com>1 parent 8582f18 commit cdafd94
1 file changed
Lines changed: 14 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1430 | 1430 | | |
1431 | 1431 | | |
1432 | 1432 | | |
1433 | | - | |
1434 | | - | |
1435 | | - | |
1436 | | - | |
1437 | | - | |
1438 | | - | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
1439 | 1437 | | |
1440 | | - | |
1441 | | - | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
1442 | 1447 | | |
1443 | 1448 | | |
1444 | | - | |
| 1449 | + | |
1445 | 1450 | | |
1446 | 1451 | | |
1447 | 1452 | | |
| |||
0 commit comments