If the game runs smooth while walking, but not when moving the mouse, then you have a High Refresh rate mouse. Lower the mouse polling rate (not to be confused with sensitivity/DPI). Here's how to do it for a Logitech G Hub mouse high-dpi-mouse-fps-fix

The reason why this works is because, in the core game engine loop, it receives messages when the mouse is moved. So in this case, if you have too many messages coming in, then it's going to cause a problem. By reducing the amount of messages, we're going to increase our frame rate because we're not going to bog down the game engine.