Hm, I've recently noticed kwin taking up what seems like way too much CPU at idle. Fedora with KDE. Happens on both X11 and Wayland with Wayland being worse and perceptibly slower.
I noticed this myself, both gnome and kde. It turned out to be that leaving Firefox open for long periods of time caused this.
I think for me jetbrains applications cause a memory leak in KWin which actually is becoming less of a problem now that I am switching to neovim slowly but surely.