Adding movement time to rotation

I’m very new to Unity, and wanted to know how to add movement time to this simple script instead of it being jerky.

public class Rotation : MonoBehaviour {

public float rotatespeed;

void Update () {

    //rotate on d press
    if (Input.GetKeyDown("d"))
            transform.Rotate(Vector3.back * rotatespeed);

    //rotate on d retract
    if (Input.GetKeyUp("d"))
        transform.Rotate(Vector3.forward * rotatespeed);

I would first make your rotation frame rate independent by multiplying the speed by deltaTime.

transform.Rotate(Vector3.back * rotatespeed  * Time.deltaTime);

If you are testing in the editor, I would try to run some tests with Maxiimize On Play enabled. A lot of stuttering happens just because of the editor overhead.

Food for thought, a lot of stuttering people see is the editor. It’s a weird beast. If you make an actual build of your app and run it on device, more than likely this type of stuttering goes away - with something as simple as this.