-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This particular kind of expression is tricky to implement because of a special case of backwards compatibility with a rarely used Nixpkgs function also named `or` (see [parser.y] for more details). [parser.y]: https://github.com/NixOS/nix/blob/f8b30338ac231262bdf19844f044f0572c460048/src/libexpr/parser.y#L376-L378 Implementing support for this fallback case incurs a slight performance penalty, as shown in the Criterion benchmark results below: ``` parse example.nix time: [681.43 us 683.99 us 686.99 us] change: [-0.9655% +2.6817% +6.4750%] (p = 0.16 > 0.05) No change in performance detected. Found 13 outliers among 100 measurements (13.00%) 5 (5.00%) high mild 8 (8.00%) high severe ``` Also, since the `or` keyword is only ever used in projections and never on its own, we can safely remove the `ExprOr` type and rely entirely on the `fallback` argument for `ExprProj::new()` instead.
- Loading branch information
1 parent
a1e4c50
commit 82149a5
Showing
2 changed files
with
32 additions
and
64 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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