mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 05:43:50 +03:00
optionAttrSetToDocList: O(n^2) -> O(n)
This shaves about 10% off memory consumption of NixOS evaluation.
This commit is contained in:
parent
3cd5fd8bb3
commit
f14dab05d6
@ -83,7 +83,7 @@ rec {
|
|||||||
optionAttrSetToDocList = optionAttrSetToDocList' [];
|
optionAttrSetToDocList = optionAttrSetToDocList' [];
|
||||||
|
|
||||||
optionAttrSetToDocList' = prefix: options:
|
optionAttrSetToDocList' = prefix: options:
|
||||||
fold (opt: rest:
|
concatMap (opt:
|
||||||
let
|
let
|
||||||
docOption = rec {
|
docOption = rec {
|
||||||
name = showOption opt.loc;
|
name = showOption opt.loc;
|
||||||
@ -101,8 +101,7 @@ rec {
|
|||||||
let ss = opt.type.getSubOptions opt.loc;
|
let ss = opt.type.getSubOptions opt.loc;
|
||||||
in if ss != {} then optionAttrSetToDocList' opt.loc ss else [];
|
in if ss != {} then optionAttrSetToDocList' opt.loc ss else [];
|
||||||
in
|
in
|
||||||
# FIXME: expensive, O(n^2)
|
[ docOption ] ++ subOptions) (collect isOption options);
|
||||||
[ docOption ] ++ subOptions ++ rest) [] (collect isOption options);
|
|
||||||
|
|
||||||
|
|
||||||
/* This function recursively removes all derivation attributes from
|
/* This function recursively removes all derivation attributes from
|
||||||
|
Loading…
Reference in New Issue
Block a user