1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 14:51:16 +02:00

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).
This commit is contained in:
Eelco Dolstra 2016-08-29 17:28:20 +02:00
parent c0a7b84748
commit 26d92017d3
7 changed files with 54 additions and 10 deletions

View file

@ -12,15 +12,6 @@ static void skipWhitespace(const char * & s)
}
#if HAVE_BOEHMGC
typedef std::vector<Value *, gc_allocator<Value *> > ValueVector;
typedef std::map<Symbol, Value *, std::less<Symbol>, gc_allocator<Value *> > ValueMap;
#else
typedef std::vector<Value *> ValueVector;
typedef std::map<Symbol, Value *> ValueMap;
#endif
static string parseJSONString(const char * & s)
{
string res;