charmbracelet / lipgloss

Style definitions for nice terminal layouts 👄
MIT License
7.89k stars 225 forks source link

Lazy loading dark background causes sporadic performance issues #86

Open orlangure opened 2 years ago

orlangure commented 2 years ago

Commit https://github.com/charmbracelet/lipgloss/commit/b3934f5a812721a2ae5b9ada1d9aa54a37014be9 for some reason started causing major sporadic performance issues in my environment: the call to HasDarkBackground sometimes takes up to one minute to complete. About 50% of the time everything runs smoothly, and other 50% it gets stuck for at least a couple of seconds.

When checking out to v0.5.0 and running git revert b3934f5, the problem disappears. The issue exists on master as well.

My environment: Alacritty 0.10.1 Tmux 3.3 Macos 12.4

muesli commented 1 year ago

Thanks for creating the issue. This is a timing issue, where both tea and lipgloss try to query the background color from the terminal. We have a fix for this in the next releases of both tea and lipgloss!