optimize performance
optimize performance

remove loops and function calls, modify arrays in place

this makes the whole thing harder to read, and probably only
marginally faster.

NixOS/nix,NixOS/nix,NixOS/nix,NixOS/nix,NixOS/nix