Episode V: The real culprit!
tl;dr: Maybe things will be solved with plasma 6.0, they were solved on the kde2nix repo.
Long read:
Like I commented also on the Quadratic thread, I also have struggled with this. On plasma5, some apps take much more than on arch, for example. Dolphin for example, is one, while konsole is not so much affected.
After lots and lots of benchmarks and searching and testing stuff (like preload, but didnt solved it), etc, I stumbled in a bug report (which google now fails to find) which gave me a clue about what to do:
Remove extra huge trillion lines XDG_DATA_DIRS and other XDG’s
So I found out that almost all can be removed, because nix apps already include the PATHs in the “what used to be quadratic scripts”, and everything started starting fast!
The good news, is that testing plasma 6.0 on the kde2nix repo, the XDG_DATA_DIRS were not so huge, and it was noticeable faster! So, maybe when integrated into nixos nixpkgs, it will keep being that way!