Open
Description
Is your feature request related to a problem? Please describe.
Current evaluator performance slightly favors
let inherit (lib) foo;
in f foo foo foo;
instead of
f lib.foo lib.foo lib.foo
Actually writing out the let
binding can be perceived as a chore, and having to think about it, or ask for it in lib
maintenance is not ideal.
Describe the solution you'd like
Perhaps perform this transformation behind the scenes.
In some cases, the transformation may be a clear win. What would be the algorithm that determines this? Is it fast enough to perform eagerly?
Describe alternatives you've considered
Keep operational semantics as is. Memory use will be slightly more predictable. File loading remains fast. Code remains simple.
Additional context
- Raised in check-meta: Improve performance nixpkgs#267309 (comment)
- The solution and problem have similarities to Naive thunk closures cause space leaks #8285
- both are forms of partial evaluation
Priorities
Add 👍 to issues you find important.