diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-08-29T15·28+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-08-29T17·36+0200 |
commit | 26d92017d3b36cff940dcb7d1611c42232edb81a (patch) | |
tree | 856350170478111ea3a61b3b457e4fbee40826ce /tests/lang/eval-okay-partition.nix | |
parent | c0a7b84748d5e27e6804117b8a57ce71269c3c66 (diff) |
Add builtin function "partition"
The implementation of "partition" in Nixpkgs is O(n^2) (because of the use of ++), and for some reason was causing stack overflows in multi-threaded evaluation (not sure why). This reduces "nix-env -qa --drv-path" runtime by 0.197s and memory usage by 298 MiB (in non-Boehm mode).
Diffstat (limited to 'tests/lang/eval-okay-partition.nix')
-rw-r--r-- | tests/lang/eval-okay-partition.nix | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/lang/eval-okay-partition.nix b/tests/lang/eval-okay-partition.nix new file mode 100644 index 000000000000..846d2ce49486 --- /dev/null +++ b/tests/lang/eval-okay-partition.nix @@ -0,0 +1,5 @@ +with import ./lib.nix; + +builtins.partition + (x: x / 2 * 2 == x) + (builtins.concatLists [ (range 0 10) (range 100 110) ]) |