Why does it take a long time to open certain config files accessible only to superuser in Vim?
For example:
$ sudo vim /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla
It takes 10 seconds on an idle computer for this tiny text file to open up in Vim. The time taken is the same no matter how many times I close and open this file. Other files owned by a normal user open in a flash.
Update: I used strace to figure out the cause of the delay. It turns out that the vim-signify plugin that I was using with Vim was causing this error. On removing the plugin, Vim opens the file in a flash. An issue has been filed with the plugin author.
If your system is really idle during that time it should not take so long to open a small file. Check if the same issue is present with other editors first.
hen check things like current memory usage, number of open files, i/o bottle necks etc using tools like top, iostat, vmstat & sar data for any issues to confirm the system is not under heavy activity when the issue reproducible. These tools help in determining what your system is doing during that time which would help you narrow down further.
If its not under any load, next thing to check is the number of files/inodes on same partition and the number of directory entries under /var/..for this use tools like dumpe2fs.
My 2 cent's, let me know if you need more help.