tachometer, review of methods

We debounce dirty signals like contact switches closing and opening (tiny sparks) which you won't get with reflected IR.

INPUT_PULLUP is ground-safe, low powered, and hold its state unterminated. But if you have it wired for some other use with a pulldown resistor after the switch then it's not going to work so well.

Try adding micros() to your print lines and shorten those labels to single-char to reduce print overhead.