I’ve been using flox significantly and have been trying to replace homebrew with flox. I have a default environment with all of the tools I use, but activating my default environment with every new window is pretty slow (3-5 seconds). This happens for each new terminal window I open, which is pretty frequent for me.
Is there anyway to speed this up when using the default environment?
~ on ☁️ (us-west-1) on ☁️ endallk007@gmail.com
❯ time zsh -i -c exit
ℹ️ Upgrades are available for packages in 'kendallm/default'.
Use 'flox upgrade' to get the latest.
zsh -i -c exit 0.98s user 1.23s system 90% cpu 2.444 total
I profiled just the activate command with zprof to see what was going on with flox and there seems to be a lot of work happening. Ideally I would replace homebrew with flox for my main dev setup, but the startup time is a bit rough for me.
zmodload zsh/zprof
eval "$(flox activate -m run -d $HOME)"
zprof
num calls time self name
-----------------------------------------------------------------------------------
1) 1 153.09 153.09 43.52% 153.09 153.09 43.52% compdump
2) 1 351.70 351.70 99.99% 79.38 79.38 22.57% compinit
3) 957 74.09 0.08 21.06% 74.09 0.08 21.06% compdef
4) 2 45.14 22.57 12.83% 45.14 22.57 12.83% compaudit
5) 1 0.05 0.05 0.01% 0.05 0.05 0.01% add-zsh-hook
-----------------------------------------------------------------------------------
2) 1 351.70 351.70 99.99% 79.38 79.38 22.57% compinit
1/2 45.14 45.14 12.83% 0.16 0.16 compaudit [4]
957/957 74.09 0.08 21.06% 74.09 0.08 compdef [3]
1/1 153.09 153.09 43.52% 153.09 153.09 compdump [1]
-----------------------------------------------------------------------------------
1/1 153.09 153.09 43.52% 153.09 153.09 compinit [2]
1) 1 153.09 153.09 43.52% 153.09 153.09 43.52% compdump
-----------------------------------------------------------------------------------
957/957 74.09 0.08 21.06% 74.09 0.08 compinit [2]
3) 957 74.09 0.08 21.06% 74.09 0.08 21.06% compdef
-----------------------------------------------------------------------------------
1/2 45.14 45.14 12.83% 0.16 0.16 compinit [2]
1/2 44.98 44.98 12.79% 44.98 44.98 compaudit [4]
4) 2 45.14 22.57 12.83% 45.14 22.57 12.83% compaudit
1/2 44.98 44.98 12.79% 44.98 44.98 compaudit [4]
-----------------------------------------------------------------------------------
5) 1 0.05 0.05 0.01% 0.05 0.05 0.01% add-zsh-hook