To get pulse sensor readings right you have three options.
- for slow pulses (lasting milliseconds each): call the function often, make sure no other function takes longer than that to finish or you will miss pulses.
- for faster pulses, or if your sketch has a lot of other work to do and you can't read the pulse sensor's input often enough, attach an interrupt to the pin and count that way.
- for very fast pulses (should work up to 8 MHz for a 16 MHz Arduino, I've done up to 1.5 MHz myself) you can connect it to a timer as external clock signal.