tweag / nickel

Better configuration for less
https://nickel-lang.org/
MIT License
2.37k stars 89 forks source link

Optimize `std.contract.Equal` using %record/split_pair% #1988

Closed yannham closed 2 months ago

yannham commented 3 months ago

The std.contract.Equal contract needs to be lazy, which means that it re-implements equality logic in pure Nickel code, which has proven to be very slow (https://github.com/tweag/nickel/issues/1930).

This commit replaces the field difference operation, implemented using a left fold, by the new builtin operator %record/split_pair%, which shows a performance improvement of around 300% for the example of #1930.