[Backport 2.32-maintenance] libexpr: Speed up BindingsBuilder::finishSizeIfNecessary#14372
Merged
edolstra merged 1 commit into2.32-maintenancefrom Oct 27, 2025
Merged
Conversation
Instead of iterating over the newly built bindings we can do a cheaper set_intersection to count duplicates or fall back to a per-element binary search over the "base" bindings. This speeds up `hello` evaluation by around 10ms (0.196s -> 0.187s) and `nixos.closures.ec2.x86_64-linux` by 140ms (2.744s -> 2.609s). This addresses a somewhat steep performance regression from 82315c3 that reduced memory requirements of attribute set merges. With this patch we get back around to 2.31 level of eval performance while keeping the memory usage optimization. Also document the optimization a bit more. (cherry picked from commit ec2fd2d)
Member
|
Not sure if we should backport this, unless it's a fix to a major performance regression. |
Contributor
Generally it's a very safe change without any functional differences and the performance uplift will help a lot in nixpkgs CI. I think @wolfgangwalther and @philiptaron will agree that it's substantial enough that it warrants a backport. |
Contributor
|
We can judge the impact on Nixpkgs CI within the week, but I'll leave it to the Nix team to decide if backporting is the right call. |
Contributor
|
I can't comment on how safe the change is or not or whether it fully fixes the performance regression. But I can say that it would be very much appreciated to fix that regression in Nixpkgs quickly. I think that means I am 👍 on a backport ;) |
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automatic backport to
2.32-maintenance, triggered by a label in #14362.