Dalius's blog

Wednesday, January 24, 2024

starship.rs subtle slowness and how I fixed it

I use fish shell together with starship.rs prompt. I have configured it long time ago and forgot. It was working perfectly, but there was subtle slowness that I was ignoring for long time.

It was not slow enough to be bothered about, but slow enough to be annoying at least couple times per day (still very low number). One day I have decided to look into it. I suspected that starship.rs might be problem and tried to comment out modules I am using. It started to work much faster. Then I tried return modules back and found out that the problem is custom time module that looks like this:

[custom.tztime]
command = 'date +"🕙%H:%M:%S"'
when = "true"
format = '[\[$symbol($output)\] ](green)'

Nothing wrong with this most probably, but it is slow enough to be noticeable sometimes. I have used native solution instead https://starship.rs/config/#time for this and in result got both performance and have not lost any functionality.

Lesson from this: if something feels off it is worth to spend some time on it.

P.S. Most probably I could have done the same faster by doing what’s recommended in FAQ: https://starship.rs/faq/#starship-is-doing-something-unexpected-how-can-i-debug-it