Extreme stuttering after kwin_x11 --replace

When I change a setting related to KWin (for example, KWin scripts), the whole desktop starts stuttering (except for the mouse cursor). I don’t know if there’s a technical word for it, but it’s like a game having a massive and continuous FPS drop. After some head-scratching and googling, I’ve realized it’s very likely happening after the kwin_x11 --replace command, since typing this in the terminal causes the same issue. But I haven’t been able to find anything else.

KDE Plasma version is 5.22.5, kernel version is 5.13.19-2, and I’m using X11 for the “graphics platform” (guessing the translation, my OS is not in English). Let me know if you need any other information about my system.

All we need to know is described in How to provide good information