I recently noticed that my Vim was loading slower than instantaneously, so I decided to benchmark it and noticed it was taking a full second:
time ex +q -u NONE
real 0m1.031s
user 0m0.020s
sys 0m0.009s
After Googling around, I came across this question and found that both of the suggested approaches makes Vim load fast again:
This gives us 20 ms load time but the clipboard does not work anymore.
time ex +q -u NONE -X
real 0m0.020s
user 0m0.004s
sys 0m0.016s
This give us 35 ms load time and the clipboard works.
time env SESSION_MANAGER="" ex +q -i NONE
real 0m0.035s
user 0m0.023s
sys 0m0.009s
For reference, my default SESSION_MANAGER
is the following:
echo $SESSION_MANAGER
local/x1-7thGen:@/tmp/.ICE-unix/2463,unix/x1-7thGen:/tmp/.ICE-unix/2463
My system OS and kernel are as follows:
cat /etc/issue
Ubuntu 20.04.6 LTS \n \l
uname -a
Linux x1-7thGen 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
What specific behavior does setting SESSION_MANAGER=""
change in Vim, and is there any reason I should not always clear this when running Vim?
From vim's source code, you can see that when no X connection or SESSION_MANAGER
is not set the there's no initialization of XSMP
if (!x_no_connect)
{
char *p = getenv("SESSION_MANAGER");
if (p != NULL && *p != NUL)
{
xsmp_init();
TIME_MSG("xsmp init");
}
}
from here.
That's why you may see a similar improvement in both cases.
See XSMP 's purpose.