Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Float out ExprSelect to larger scope #9592

Open
roberth opened this issue Dec 11, 2023 · 1 comment
Open

Float out ExprSelect to larger scope #9592

roberth opened this issue Dec 11, 2023 · 1 comment
Labels
feature Feature request or proposal language The Nix expression language; parser, interpreter, primops, evaluation, etc performance

Comments

@roberth
Copy link
Member

roberth commented Dec 11, 2023

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

Priorities

Add 👍 to issues you find important.

@roberth roberth added the feature Feature request or proposal label Dec 11, 2023
@roberth roberth added language The Nix expression language; parser, interpreter, primops, evaluation, etc performance labels Dec 11, 2023
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/removing-most-uses-of-top-level-with/41233/3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request or proposal language The Nix expression language; parser, interpreter, primops, evaluation, etc performance
Projects
None yet
Development

No branches or pull requests

2 participants