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).
		
			
				
	
	
		
			5 lines
		
	
	
	
		
			123 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			5 lines
		
	
	
	
		
			123 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
| with import ./lib.nix;
 | |
| 
 | |
| builtins.partition
 | |
|   (x: x / 2 * 2 == x)
 | |
|   (builtins.concatLists [ (range 0 10) (range 100 110) ])
 |