about summary refs log tree commit diff
path: root/tvix/eval/src/value/attrs.rs
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@tvl.su>2023-11-02T15·15+0300
committerclbot <clbot@tvl.fyi>2023-11-03T09·24+0000
commitd91fcd4f289451b577c9af864cd96843b6e5bf26 (patch)
tree36634caee63ab946360e692b32b38b4932d9c1e8 /tvix/eval/src/value/attrs.rs
parentb7ea3d7b326f4d193092fc64f9bb97f7a013298c (diff)
refactor(tvix/eval): more efficiently intersect attributes r/6930
builtins.intersectAttrs is used a _lot_ in nixpkgs eval, for whatever
reason. We previously had a very inefficient implementation that would
allocate for each comparison. It stuck out like a sore thumb in perf
analysis.

This moves to a custom algorithm with two iterators, one for the left
and one for the right side, advancing them along the (borrowed) map
keys until a match is found and allocation is required.

I've not made any effort to reduce the verbosity of this code, I don't
think it's worth it.

On my machine this reduces the mean runtime of evaluating
`nixpkgs.emacs.outPath` by ~8%.

Change-Id: Ie506d82cb8d5f45909628f771a6b73e0eca16b27
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9898
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/eval/src/value/attrs.rs')
0 files changed, 0 insertions, 0 deletions